fix orb sync when notplayer, fix ng+ as notplayer

This commit is contained in:
bgkillas 2024-08-27 17:00:55 -04:00
parent 83de7c4913
commit 1c74e6db4b
4 changed files with 26 additions and 5 deletions

View file

@ -19,7 +19,7 @@ function rpc.gather_and_do_ending(x, y, sx, sy)
end
async(function()
if died then
wait(1)
wait(40)
end
net.proxy_send("reset_world", "")
EntitySetTransform(ctx.my_player.entity, x, y)

View file

@ -57,6 +57,9 @@ end
function rpc.send_effects(effects)
local entity = ctx.rpc_player_data.entity
if not EntityGetIsAlive(entity) then
return
end
local confirmed_effects = {}
for _, effect in ipairs(effects) do
local effect_remote_id = effect[1]

View file

@ -4,12 +4,14 @@ local last_orb_count = 0
local module = {}
local wait_for_these
local function orbs_found_this_run()
local wsc = EntityGetFirstComponent(GameGetWorldStateEntity(), "WorldStateComponent")
return ComponentGetValue2(wsc, "orbs_found_thisrun")
end
function rpc.update_orbs(found_orbs)
local function actual_orbs_update(found_orbs)
local found_local = orbs_found_this_run()
for _, orb in ipairs(found_orbs) do
if table.contains(found_local, orb) then
@ -31,12 +33,23 @@ function rpc.update_orbs(found_orbs)
last_orb_count = GameGetOrbCountThisRun()
end
function rpc.update_orbs(found_orbs)
if EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
wait_for_these = found_orbs
return
end
actual_orbs_update(found_orbs)
end
local function send_orbs()
rpc.update_orbs(orbs_found_this_run())
end
function module.on_world_update()
if last_orb_count ~= GameGetOrbCountThisRun() then
if wait_for_these ~= nil and not EntityHasTag(ctx.my_player.entity, "ew_notplayer") then
actual_orbs_update(wait_for_these)
wait_for_these = nil
elseif last_orb_count ~= GameGetOrbCountThisRun() then
last_orb_count = GameGetOrbCountThisRun()
send_orbs()
end
@ -48,4 +61,4 @@ function module.on_should_send_updates()
end
end
return module
return module

View file

@ -107,7 +107,12 @@ function OnProjectileFired(shooter_id, projectile_id, initial_rng, position_x, p
end
EntityAddTag(projectile_id, "ew_no_enemy_sync")
local projectileComponent = EntityGetFirstComponentIncludingDisabled(projectile_id, "ProjectileComponent")
local entity_that_shot = ComponentGetValue2(projectileComponent, "mEntityThatShot")
local entity_that_shot
if projectileComponent == nil then
entity_that_shot = GameGetWorldStateEntity()
else
entity_that_shot = ComponentGetValue2(projectileComponent, "mEntityThatShot")
end
local shooter_player_data = player_fns.get_player_data_by_local_entity_id(shooter_id)
local rng = 0