mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-25 03:51:05 +01:00
19 lines
364 B
Lua
19 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
|