forked from MineClone5/MineClone5
mcl_damage: HP check guard in non-modifier on_hpchange callback and usage of raw tostring for deactivated objects for death messages
This commit is contained in:
parent
1bd647507b
commit
f53ff8418f
|
@ -149,7 +149,7 @@ minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
|||
end, true)
|
||||
|
||||
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
||||
if hp_change < 0 then
|
||||
if hp_change < 0 and player:get_hp() > 0 then
|
||||
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
|
||||
end
|
||||
end, false)
|
||||
|
|
|
@ -539,7 +539,7 @@ function mcl_util.get_object_name(object)
|
|||
local luaentity = object:get_luaentity()
|
||||
|
||||
if not luaentity then
|
||||
return ""
|
||||
return tostring(object)
|
||||
end
|
||||
|
||||
return luaentity.nametag and luaentity.nametag ~= "" and luaentity.nametag or luaentity.description or luaentity.name
|
||||
|
|
|
@ -204,8 +204,9 @@ mcl_damage.register_on_death(function(obj, reason)
|
|||
|
||||
if obj:is_player() then
|
||||
send_to = true
|
||||
end -- ToDo: add mob death messages for owned mobs, only send to owner (sent_to = "player name")
|
||||
end
|
||||
|
||||
-- ToDo: add mob death messages for owned mobs, only send to owner (sent_to = "player name")
|
||||
|
||||
if send_to then
|
||||
local messages = mcl_death_messages.messages[reason.type] or {}
|
||||
|
|
Loading…
Reference in New Issue