Respect immortal armor group, ensuring objects are not dealt damage

Context: some objects such as chest, frame or sign entities are set to
be immortal, because they are tied to a node and should not be removed
on their own.

However since immortality wasn't respected, it would lead to odd desync
issues between nodes and accompanying entities. An example is a chest
that becomes invisible when struck by lightning or anvil.
This commit is contained in:
emptyshore 2023-02-01 18:29:29 +13:00
parent 6f67f0e095
commit bdc82b76b5

@ -556,6 +556,11 @@ function mcl_util.deal_damage(target, damage, mcl_reason)
end
end
local is_immortal = target:get_armor_groups().immortal or 0
if is_immortal>0 then
return
end
local hp = target:get_hp()
if hp > 0 then