forked from VoxeLibre/VoxeLibre
Add back the explosion death msg
This commit is contained in:
parent
7fa8828bd5
commit
d4bc7a2f88
|
@ -10,10 +10,12 @@ This mod was created by Elias Astrom <ryvnf@riseup.net> and is released
|
||||||
under the LGPLv2.1 license.
|
under the LGPLv2.1 license.
|
||||||
--]]
|
--]]
|
||||||
|
|
||||||
|
|
||||||
mcl_explosions = {}
|
mcl_explosions = {}
|
||||||
|
|
||||||
local creative_mode = minetest.settings:get_bool("creative_mode")
|
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
|
-- Saved sphere explosion shapes for various radiuses
|
||||||
local sphere_shapes = {}
|
local sphere_shapes = {}
|
||||||
|
@ -280,6 +282,9 @@ local function trace_explode(pos, strength, raydirs, radius, drop_chance)
|
||||||
impact = 0
|
impact = 0
|
||||||
end
|
end
|
||||||
local damage = math.floor((impact * impact + impact) * 7 * strength + 1)
|
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,
|
obj:punch(obj, 10, { damage_groups = { full_punch_interval = 1,
|
||||||
fleshy = damage, knockback = impact * 20.0 } }, punch_dir)
|
fleshy = damage, knockback = impact * 20.0 } }, punch_dir)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,2 @@
|
||||||
|
# textdomain:mcl_explosions
|
||||||
|
@1 was caught in an explosion.=@1 wurde Opfer einer Explosion.
|
|
@ -0,0 +1,2 @@
|
||||||
|
# textdomain:mcl_explosions
|
||||||
|
@1 was caught in an explosion.=
|
|
@ -174,13 +174,16 @@ minetest.register_on_dieplayer(function(player, reason)
|
||||||
-- Punches
|
-- Punches
|
||||||
local hitter = reason.object
|
local hitter = reason.object
|
||||||
local hittername, hittertype, hittersubtype, shooter
|
local hittername, hittertype, hittersubtype, shooter
|
||||||
|
-- Custom message
|
||||||
|
if last_damages[name] then
|
||||||
|
msg = last_damages[name].message
|
||||||
-- Unknown hitter
|
-- Unknown hitter
|
||||||
if hitter == nil then
|
elseif hitter == nil then
|
||||||
msg = dmsg("murder_any", name)
|
msg = dmsg("murder_any", name)
|
||||||
-- Player
|
-- Player
|
||||||
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 and hittername ~= name then
|
||||||
msg = dmsg("murder", name, hittername)
|
msg = dmsg("murder", name, hittername)
|
||||||
else
|
else
|
||||||
msg = dmsg("murder_any", name)
|
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, player:get_player_name(), sequence_number)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Send a custom death mesage when 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.
|
-- 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 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.
|
-- 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)
|
function mcl_death_messages.player_damage(player, message)
|
||||||
|
|
Loading…
Reference in New Issue