From d4bc7a2f880f94a6ba2e39e95940da73638c95a6 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 2 May 2020 18:09:25 +0200 Subject: [PATCH] Add back the explosion death msg --- mods/CORE/mcl_explosions/init.lua | 7 ++++++- mods/CORE/mcl_explosions/locale/mcl_explosions.de.tr | 2 ++ mods/CORE/mcl_explosions/locale/template.txt | 2 ++ mods/HUD/mcl_death_messages/init.lua | 11 +++++++---- 4 files changed, 17 insertions(+), 5 deletions(-) create mode 100644 mods/CORE/mcl_explosions/locale/mcl_explosions.de.tr create mode 100644 mods/CORE/mcl_explosions/locale/template.txt diff --git a/mods/CORE/mcl_explosions/init.lua b/mods/CORE/mcl_explosions/init.lua index 18795299..99cdb0fe 100644 --- a/mods/CORE/mcl_explosions/init.lua +++ b/mods/CORE/mcl_explosions/init.lua @@ -10,10 +10,12 @@ This mod was created by Elias Astrom and is released under the LGPLv2.1 license. --]] - mcl_explosions = {} local creative_mode = minetest.settings:get_bool("creative_mode") +local mod_death_messages = minetest.get_modpath("mcl_death_messages") ~= nil + +local S = minetest.get_translator("mcl_explosions") -- Saved sphere explosion shapes for various radiuses local sphere_shapes = {} @@ -280,6 +282,9 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance) impact = 0 end local damage = math.floor((impact * impact + impact) * 7 * strength + 1) + if mod_death_messages and obj:is_player() then + mcl_death_messages.player_damage(obj, S("@1 was caught in an explosion.", obj:get_player_name())) + end obj:punch(obj, 10, { damage_groups = { full_punch_interval = 1, fleshy = damage, knockback = impact * 20.0 } }, punch_dir) diff --git a/mods/CORE/mcl_explosions/locale/mcl_explosions.de.tr b/mods/CORE/mcl_explosions/locale/mcl_explosions.de.tr new file mode 100644 index 00000000..4abbc64b --- /dev/null +++ b/mods/CORE/mcl_explosions/locale/mcl_explosions.de.tr @@ -0,0 +1,2 @@ +# textdomain:mcl_explosions +@1 was caught in an explosion.=@1 wurde Opfer einer Explosion. diff --git a/mods/CORE/mcl_explosions/locale/template.txt b/mods/CORE/mcl_explosions/locale/template.txt new file mode 100644 index 00000000..6a9348dd --- /dev/null +++ b/mods/CORE/mcl_explosions/locale/template.txt @@ -0,0 +1,2 @@ +# textdomain:mcl_explosions +@1 was caught in an explosion.= diff --git a/mods/HUD/mcl_death_messages/init.lua b/mods/HUD/mcl_death_messages/init.lua index e32de137..25be9326 100644 --- a/mods/HUD/mcl_death_messages/init.lua +++ b/mods/HUD/mcl_death_messages/init.lua @@ -174,13 +174,16 @@ minetest.register_on_dieplayer(function(player, reason) -- Punches local hitter = reason.object local hittername, hittertype, hittersubtype, shooter + -- Custom message + if last_damages[name] then + msg = last_damages[name].message -- Unknown hitter - if hitter == nil then + elseif hitter == nil then msg = dmsg("murder_any", name) -- Player elseif hitter:is_player() then hittername = hitter:get_player_name() - if hittername ~= nil then + if hittername ~= nil and hittername ~= name then msg = dmsg("murder", name, hittername) else msg = dmsg("murder_any", name) @@ -263,8 +266,8 @@ local start_damage_reset_countdown = function (player, sequence_number) end, player:get_player_name(), sequence_number) end --- Send a custom death mesage when damaging a player via set_hp. --- To be called directly BEFORE damaging a player via set_hp. +-- Send a custom death mesage when damaging a player via set_hp or punch. +-- To be called directly BEFORE damaging a player via set_hp or punch. -- The next time the player dies due to a set_hp, the message will be shown. -- The player must die via set_hp within 0.1 seconds, otherwise the message will be discarded. function mcl_death_messages.player_damage(player, message)