mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
Cleanup
This commit is contained in:
parent
336e87e869
commit
749025b2ef
1 changed files with 16 additions and 11 deletions
|
@ -27,18 +27,25 @@ function effect_sync.get_ent_effects(entity)
|
|||
return list
|
||||
end
|
||||
|
||||
local local_by_remote_id = {}
|
||||
|
||||
function effect_sync.on_world_update()
|
||||
if GameGetFrameNum() % 30 ~= 9 then
|
||||
return
|
||||
if GameGetFrameNum() % 30 == 9 then
|
||||
local effects = effect_sync.get_ent_effects(ctx.my_player.entity)
|
||||
local sync_data = {}
|
||||
for _, effect in ipairs(effects) do
|
||||
table.insert(sync_data, {effect, np.SerializeEntity(effect)})
|
||||
end
|
||||
rpc.send_effects(sync_data)
|
||||
end
|
||||
|
||||
local effects = effect_sync.get_ent_effects(ctx.my_player.entity)
|
||||
local sync_data = {}
|
||||
for _, effect in ipairs(effects) do
|
||||
table.insert(sync_data, {effect, np.SerializeEntity(effect)})
|
||||
-- Cleanup
|
||||
if GameGetFrameNum() % 120 == 9 then
|
||||
for rem_id, loc_id in pairs(local_by_remote_id) do
|
||||
if not EntityGetIsAlive(loc_id) then
|
||||
local_by_remote_id[rem_id] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
rpc.send_effects(sync_data)
|
||||
end
|
||||
|
||||
function effect_sync.remove_all_effects(entity)
|
||||
|
@ -48,8 +55,6 @@ function effect_sync.remove_all_effects(entity)
|
|||
end
|
||||
end
|
||||
|
||||
local local_by_remote_id = {}
|
||||
|
||||
function rpc.send_effects(effects)
|
||||
local entity = ctx.rpc_player_data.entity
|
||||
local confirmed_effects = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue