mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
sync main body enemy animations
This commit is contained in:
parent
e133ee6433
commit
d929eac6e6
1 changed files with 24 additions and 1 deletions
|
@ -255,7 +255,13 @@ function enemy_sync.host_upload_entities()
|
|||
|
||||
local effect_data = effect_sync.get_sync_data(enemy_id)
|
||||
|
||||
table.insert(enemy_data_list, {filename, en_data, not_ephemerial, phys_info, phys_info_2, has_wand, effect_data})
|
||||
local sprite = EntityGetFirstComponent(enemy_id, "SpriteComponent")
|
||||
local animation
|
||||
if sprite ~= nil then
|
||||
animation = ComponentGetValue2(sprite, "rect_animation")
|
||||
end
|
||||
|
||||
table.insert(enemy_data_list, {filename, en_data, not_ephemerial, phys_info, phys_info_2, has_wand, effect_data, animation})
|
||||
::continue::
|
||||
end
|
||||
|
||||
|
@ -427,6 +433,7 @@ function rpc.handle_enemy_data(enemy_data)
|
|||
local phys_infos_2 = enemy_info_raw[5]
|
||||
local has_wand = enemy_info_raw[6]
|
||||
local effects = enemy_info_raw[7]
|
||||
local animation = enemy_info_raw[8]
|
||||
local has_died = filename == nil
|
||||
|
||||
local frame = GameGetFrameNum()
|
||||
|
@ -488,6 +495,16 @@ function rpc.handle_enemy_data(enemy_data)
|
|||
if pick_up ~= nil then
|
||||
EntityRemoveComponent(enemy_id, pick_up)
|
||||
end
|
||||
local sprite = EntityGetFirstComponent(enemy_id, "SpriteComponent")
|
||||
if sprite ~= nil and ComponentGetValue2(sprite, "visible") then
|
||||
ComponentSetValue2(sprite, "visible", false)
|
||||
local comp = EntityAddComponent2(enemy_id, "SpriteComponent", {
|
||||
image_file = ComponentGetValue2(sprite, "image_file"),
|
||||
emissive = ComponentGetValue2(sprite, "emissive"),
|
||||
additive = ComponentGetValue2(sprite, "additive"),
|
||||
})
|
||||
ComponentAddTag(comp, "ew_sprite")
|
||||
end
|
||||
end
|
||||
|
||||
local enemy_data_new = ctx.entity_by_remote_id[remote_enemy_id]
|
||||
|
@ -560,6 +577,12 @@ function rpc.handle_enemy_data(enemy_data)
|
|||
|
||||
effect_sync.apply_effects(effects, enemy_id)
|
||||
|
||||
local sprite = EntityGetFirstComponent(enemy_id, "SpriteComponent", "ew_sprite")
|
||||
if sprite ~= nil then
|
||||
ComponentSetValue2(sprite, "rect_animation", animation)
|
||||
ComponentSetValue2(sprite, "next_rect_animation", animation)
|
||||
end
|
||||
|
||||
::continue::
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue