1
0
Fork 0

fix weird death message (#1378)

This commit is contained in:
AFCMS 2021-03-26 11:49:41 +01:00
parent 25f6a9ee23
commit c0308c7c08
1 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,8 @@
local S = minetest.get_translator("mcl_death_messages") local S = minetest.get_translator("mcl_death_messages")
local N = function(s) return s end local N = function(s) return s end
local C = minetest.colorize
local color_skyblue = mcl_colors.AQUA
local function get_tool_name(item) local function get_tool_name(item)
local name = item:get_meta():get_string("name") local name = item:get_meta():get_string("name")
@ -41,6 +44,9 @@ local msgs = {
["murder"] = { ["murder"] = {
N("@1 was slain by @2 using [@3]"), N("@1 was slain by @2 using [@3]"),
}, },
["murder_hand"] = {
N("@1 was slain by @2"),
},
["murder_any"] = { ["murder_any"] = {
N("@1 was killed."), N("@1 was killed."),
}, },
@ -131,7 +137,7 @@ local last_damages = { }
minetest.register_on_dieplayer(function(player, reason) minetest.register_on_dieplayer(function(player, reason)
-- Death message -- Death message
local message = minetest.settings:get_bool("mcl_showDeathMessages") local message = minetest.settings:get_bool("mcl_showDeathMessages") --Maybe cache the setting?
if message == nil then if message == nil then
message = true message = true
end end
@ -201,7 +207,11 @@ minetest.register_on_dieplayer(function(player, reason)
elseif hitter:is_player() then elseif hitter:is_player() then
hittername = hitter:get_player_name() hittername = hitter:get_player_name()
if hittername ~= nil then if hittername ~= nil then
msg = dmsg("murder", name, hittername, minetest.colorize("#00FFFF", hitter_toolname)) if hitter_toolname == "" then
msg = dmsg("murder_hand", name, hittername)
else
msg = dmsg("murder", name, hittername, C(color_skyblue, hitter_toolname))
end
else else
msg = dmsg("murder_any", name) msg = dmsg("murder_any", name)
end end
@ -229,7 +239,7 @@ minetest.register_on_dieplayer(function(player, reason)
if shooter == nil then if shooter == nil then
msg = dmsg("arrow", name) msg = dmsg("arrow", name)
elseif shooter:is_player() then elseif shooter:is_player() then
msg = dmsg("arrow_name", name, shooter:get_player_name(), minetest.colorize("#00FFFF", get_tool_name(shooter:get_wielded_item()))) msg = dmsg("arrow_name", name, shooter:get_player_name(), C(color_skyblue, get_tool_name(shooter:get_wielded_item())))
elseif s_ent and s_ent._cmi_is_mob then elseif s_ent and s_ent._cmi_is_mob then
if s_ent.nametag ~= "" then if s_ent.nametag ~= "" then
msg = dmsg("arrow_name", name, shooter:get_player_name(), get_tool_name(shooter:get_wielded_item())) msg = dmsg("arrow_name", name, shooter:get_player_name(), get_tool_name(shooter:get_wielded_item()))