VoxeLibre/mods/CORE/mcl_mob/init.lua
2021-03-17 11:08:14 +01:00

18 lines
364 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(hp_change, source, info)
MCLEntity.on_damage(self, hp_change, source, info)
local new_hp = self:get_hp()
if new_hp <= 0 and new_hp + hp_change > 0 then
self:on_death(source)
end
end