VoxeLibre/mods/CORE/mcl_mob/init.lua
Elias Fleckenstein 9ce59d4438 Rework armor (WIP)
2021-03-17 15:21:27 +01:00

18 lines
343 B
Lua

MCLMob = class(MCLEntity)
function MCLMob:get_hp()
self:meta():get_float("hp")
end
function MCLMob:set_hp()
self:meta():set_float("hp", hp)
end
function MCLMob:on_damage(damage, source)
MCLEntity.on_damage(self, damage, source)
local new_hp = self:get_hp()
if new_hp <= 0 and new_hp + damage > 0 then
self:on_death(source)
end
end