mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
fix orb sync when notplayer, fix ng+ as notplayer
This commit is contained in:
parent
83de7c4913
commit
1c74e6db4b
4 changed files with 26 additions and 5 deletions
|
@ -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)
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue