fix enemy spawning enemys on clients oddly

This commit is contained in:
bgkillas 2024-09-14 11:46:28 -04:00
parent b8d4adf809
commit 8d2b965b0a

View file

@ -489,6 +489,14 @@ function rpc.handle_enemy_data(enemy_data)
ComponentSetValue2(phys_component, "destroy_body_if_entity_destroyed", true) ComponentSetValue2(phys_component, "destroy_body_if_entity_destroyed", true)
end end
end end
for _, com in ipairs(EntityGetComponent(enemy_id, "LuaComponent") or {}) do
local script = ComponentGetValue2(com, "script_damage_received")
if script ~= nil and (script == "data/scripts/animals/leader_damage.lua" or script == "data/scripts/animals/giantshooter_death.lua") then
EntityRemoveComponent(enemy_id, com)
end
end
-- Make sure stuff doesn't decide to explode on clients by itself. -- Make sure stuff doesn't decide to explode on clients by itself.
local expl_component = EntityGetFirstComponent(enemy_id, "ExplodeOnDamageComponent") local expl_component = EntityGetFirstComponent(enemy_id, "ExplodeOnDamageComponent")
if expl_component ~= nil and expl_component ~= 0 then if expl_component ~= nil and expl_component ~= 0 then