mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
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)
|
end, true)
|
||||||
|
|
||||||
minetest.register_on_player_hpchange(function(player, hp_change, mt_reason)
|
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))
|
mcl_damage.run_damage_callbacks(player, -hp_change, mcl_damage.from_mt(mt_reason))
|
||||||
end
|
end
|
||||||
end, false)
|
end, false)
|
||||||
|
@ -539,7 +539,7 @@ function mcl_util.get_object_name(object)
|
|||||||
local luaentity = object:get_luaentity()
|
local luaentity = object:get_luaentity()
|
||||||
|
|
||||||
if not luaentity then
|
if not luaentity then
|
||||||
return ""
|
return tostring(object)
|
||||||
end
|
end
|
||||||
|
|
||||||
return luaentity.nametag and luaentity.nametag ~= "" and luaentity.nametag or luaentity.description or luaentity.name
|
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
|
if obj:is_player() then
|
||||||
send_to = true
|
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
|
if send_to then
|
||||||
local messages = mcl_death_messages.messages[reason.type] or {}
|
local messages = mcl_death_messages.messages[reason.type] or {}
|
||||||
|
Loading…
Reference in New Issue
Block a user