0
0
Fork 0

Interpret many damage sources as punches

This commit is contained in:
Wuzzy 2020-02-17 18:37:23 +01:00
parent dcc14d1f3f
commit 988ca6ffe7
7 changed files with 15 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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()

View File

@ -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.

View File

@ -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.=

View File

@ -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,

View File

@ -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