mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-28 21:41:06 +01:00
18 lines
343 B
Lua
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
|