sync more enemy animations

This commit is contained in:
bgkillas 2024-08-29 11:22:07 -04:00
parent d929eac6e6
commit 9b7776e25a
2 changed files with 7 additions and 12 deletions

View file

@ -495,15 +495,9 @@ 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")
for _, sprite in pairs(EntityGetComponent(enemy_id, "SpriteComponent", "character") or {}) do
ComponentAddTag(sprite, "ew_sprite")
ComponentRemoveTag(sprite, "character")
end
end
@ -577,8 +571,7 @@ 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
for _, sprite in pairs(EntityGetComponent(enemy_id, "SpriteComponent", "ew_sprite") or {}) do
ComponentSetValue2(sprite, "rect_animation", animation)
ComponentSetValue2(sprite, "next_rect_animation", animation)
end

View file

@ -193,7 +193,9 @@ function spectate.on_world_update()
if cam_target.entity ~= ctx.my_player.entity then
local inv_spec = EntityGetFirstComponent(cam_target.entity, "InventoryGuiComponent")
local inv_me = EntityGetFirstComponent(ctx.my_player.entity, "InventoryGuiComponent")
if inv_spec ~= nil then
ComponentSetValue2(inv_spec, "mActive", false)
end
ComponentSetValue2(inv_me, "mActive", false)
end
end