1
0
Fork 0

Add back the explosion death msg

objects
Wuzzy 2020-05-02 18:09:25 +02:00
parent 7fa8828bd5
commit d4bc7a2f88
4 changed files with 17 additions and 5 deletions

View File

@ -10,10 +10,12 @@ This mod was created by Elias Astrom <ryvnf@riseup.net> 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)

View File

@ -0,0 +1,2 @@
# textdomain:mcl_explosions
@1 was caught in an explosion.=@1 wurde Opfer einer Explosion.

View File

@ -0,0 +1,2 @@
# textdomain:mcl_explosions
@1 was caught in an explosion.=

View File

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