mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
Merge pull request #29 from Furrior/ambrosia
fix: ambrosia blocking damage sync
This commit is contained in:
commit
5e7d099d01
1 changed files with 10 additions and 11 deletions
|
@ -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 )
|
||||
-- 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 health = ComponentGetValue2(host_damageModelComponent, "hp")
|
||||
if not health 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)
|
||||
end
|
||||
ComponentSetValue2(host_damageModelComponent, "hp", health - damage)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue