From 988ca6ffe70d79e28c0752d282f1c94a683717d0 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 17 Feb 2020 18:37:23 +0100 Subject: [PATCH] Interpret many damage sources as punches --- mods/ENTITIES/mcl_falling_nodes/init.lua | 2 +- mods/ENVIRONMENT/lightning/init.lua | 4 ++-- mods/HUD/mcl_death_messages/init.lua | 10 ++++++++-- .../mcl_death_messages/locale/mcl_death_messages.de.tr | 1 + mods/HUD/mcl_death_messages/locale/template.txt | 1 + mods/ITEMS/mcl_nether/init.lua | 2 +- mods/PLAYER/mcl_playerplus/init.lua | 2 +- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/mods/ENTITIES/mcl_falling_nodes/init.lua b/mods/ENTITIES/mcl_falling_nodes/init.lua index 5e1168ca9..8fe4f17da 100644 --- a/mods/ENTITIES/mcl_falling_nodes/init.lua +++ b/mods/ENTITIES/mcl_falling_nodes/init.lua @@ -57,7 +57,7 @@ local deal_falling_damage = function(self, dtime) mcl_death_messages.player_damage(v, msg) end end - v:set_hp(hp) + v:set_hp(hp, { type = "punch", from = "mod" }) end end end diff --git a/mods/ENVIRONMENT/lightning/init.lua b/mods/ENVIRONMENT/lightning/init.lua index bf077105d..6ed0fafc0 100644 --- a/mods/ENVIRONMENT/lightning/init.lua +++ b/mods/ENVIRONMENT/lightning/init.lua @@ -132,7 +132,7 @@ lightning.strike = function(pos) if minetest.get_modpath("mcl_death_messages") then mcl_death_messages.player_damage(obj, S("@1 was struck by lightning.", obj:get_player_name())) end - obj:set_hp(obj:get_hp()-5) + obj:set_hp(obj:get_hp()-5, { type = "punch", from = "mod" }) -- Mobs elseif lua and lua._cmi_is_mob then -- pig → zombie pigman (no damage) @@ -164,7 +164,7 @@ lightning.strike = function(pos) -- Other mobs: Just damage else - obj:set_hp(obj:get_hp()-5, "lightning") + obj:set_hp(obj:get_hp()-5, { type = "punch", from = "mod" }) end end end diff --git a/mods/HUD/mcl_death_messages/init.lua b/mods/HUD/mcl_death_messages/init.lua index 7bfef748c..e32de1373 100644 --- a/mods/HUD/mcl_death_messages/init.lua +++ b/mods/HUD/mcl_death_messages/init.lua @@ -32,6 +32,9 @@ local msgs = { ["murder"] = { N("@1 was killed by @2."), }, + ["murder_any"] = { + N("@1 was killed."), + }, ["mob_kill"] = { N("@1 was killed by a mob."), }, @@ -127,7 +130,10 @@ minetest.register_on_dieplayer(function(player, reason) return end local msg - if reason.type == "node_damage" then + if last_damages[name] then + -- custom message + msg = last_damages[name].message + elseif reason.type == "node_damage" then local pos = player:get_pos() -- Check multiple nodes because players occupy multiple nodes -- (we add one additional node because the check may fail if the player was @@ -170,7 +176,7 @@ minetest.register_on_dieplayer(function(player, reason) local hittername, hittertype, hittersubtype, shooter -- Unknown hitter if hitter == nil then - msg = dmsg("murder_any") + msg = dmsg("murder_any", name) -- Player elseif hitter:is_player() then hittername = hitter:get_player_name() diff --git a/mods/HUD/mcl_death_messages/locale/mcl_death_messages.de.tr b/mods/HUD/mcl_death_messages/locale/mcl_death_messages.de.tr index a37f556d5..b9ef6680d 100644 --- a/mods/HUD/mcl_death_messages/locale/mcl_death_messages.de.tr +++ b/mods/HUD/mcl_death_messages/locale/mcl_death_messages.de.tr @@ -10,6 +10,7 @@ @1 drowned.=@1 ertrank. @1 ran out of oxygen.=@1 ging die Luft aus. @1 was killed by @2.=@1 wurde von @2 getötet. +@1 was killed.=@1 wurde getötet. @1 was killed by a mob.=@1 wurde von einem Mob getötet. @1 was burned to death by a blaze's fireball.=@1 wurde von einem Feuerball einer Lohe zu Tode verbrannt. @1 was killed by a fireball from a blaze.=@1 wurde von einem Feuerball einer Lohe getötet. diff --git a/mods/HUD/mcl_death_messages/locale/template.txt b/mods/HUD/mcl_death_messages/locale/template.txt index fc83e2963..db074f756 100644 --- a/mods/HUD/mcl_death_messages/locale/template.txt +++ b/mods/HUD/mcl_death_messages/locale/template.txt @@ -10,6 +10,7 @@ @1 drowned.= @1 ran out of oxygen.= @1 was killed by @2.= +@1 was killed.= @1 was killed by a mob.= @1 was burned to death by a blaze's fireball.= @1 was killed by a fireball from a blaze.= diff --git a/mods/ITEMS/mcl_nether/init.lua b/mods/ITEMS/mcl_nether/init.lua index f183fcc02..4025d360f 100644 --- a/mods/ITEMS/mcl_nether/init.lua +++ b/mods/ITEMS/mcl_nether/init.lua @@ -100,7 +100,7 @@ minetest.register_node("mcl_nether:magma", { if mod_death_messages then mcl_death_messages.player_damage(player, S("@1 stood too long on a magma block.", player:get_player_name())) end - player:set_hp(player:get_hp() - 1) + player:set_hp(player:get_hp() - 1, { type = "punch", from = "mod" }) end end, _mcl_blast_resistance = 2.5, diff --git a/mods/PLAYER/mcl_playerplus/init.lua b/mods/PLAYER/mcl_playerplus/init.lua index c3315f42c..19e5c2d54 100644 --- a/mods/PLAYER/mcl_playerplus/init.lua +++ b/mods/PLAYER/mcl_playerplus/init.lua @@ -137,7 +137,7 @@ minetest.register_globalstep(function(dtime) if dist < 1.1 or dist_feet < 1.1 then if player:get_hp() > 0 then mcl_death_messages.player_damage(player, S("@1 was prickled to death by a cactus.", name)) - player:set_hp(player:get_hp() - 1) + player:set_hp(player:get_hp() - 1, { type = "punch", from = "mod" }) end end end