From f53ff8418f6f9628c3efbf9bf80afdf02a505558 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 5 May 2021 13:24:23 +0200 Subject: [PATCH] mcl_damage: HP check guard in non-modifier on_hpchange callback and usage of raw tostring for deactivated objects for death messages --- mods/CORE/mcl_damage/init.lua | 2 +- mods/CORE/mcl_util/init.lua | 2 +- mods/HUD/mcl_death_messages/init.lua | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/CORE/mcl_damage/init.lua b/mods/CORE/mcl_damage/init.lua index 983b82b49..c6f91d414 100644 --- a/mods/CORE/mcl_damage/init.lua +++ b/mods/CORE/mcl_damage/init.lua @@ -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) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 01fd5e8ff..1bf3add38 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -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 diff --git a/mods/HUD/mcl_death_messages/init.lua b/mods/HUD/mcl_death_messages/init.lua index 9087c41e9..0432c3488 100644 --- a/mods/HUD/mcl_death_messages/init.lua +++ b/mods/HUD/mcl_death_messages/init.lua @@ -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 {}