Merge pull request #29 from Furrior/ambrosia

fix: ambrosia blocking damage sync
This commit is contained in:
IQuant 2024-05-23 13:37:42 +03:00 committed by GitHub
commit 5e7d099d01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,14 +1,13 @@
function damage_received( damage, message, entity_thats_responsible, is_fatal, projectile_thats_responsible )
local entity_id = GetUpdatedEntityID()
local damageModelComponent = EntityGetFirstComponentIncludingDisabled( entity_id, "DamageModelComponent" )
if damageModelComponent ~= nil then
local health = ComponentGetValue2( damageModelComponent, "hp" )
if health then
ComponentSetValue2( damageModelComponent, "hp", health + damage )
end
-- Called on host when clients get damage and redirects it straight to the host's hp, ignoring any resists.
function damage_received(damage, message, entity_thats_responsible, is_fatal, projectile_thats_responsible)
local host_entity_id = EntityGetWithTag("ew_host")[1]
local host_damageModelComponent = EntityGetFirstComponentIncludingDisabled(host_entity_id, "DamageModelComponent")
if not host_damageModelComponent then
return
end
local host_ent = EntityGetWithTag("ew_host")[1]
if host_ent ~= nil then
EntityInflictDamage(host_ent, damage, "DAMAGE_CURSE", message, "NONE", 0, 0, entity_thats_responsible)
local health = ComponentGetValue2(host_damageModelComponent, "hp")
if not health then
return
end
ComponentSetValue2(host_damageModelComponent, "hp", health - damage)
end