forked from Mineclonia/Mineclonia
More death messages, more reliable
This commit is contained in:
parent
db8d7af245
commit
20576431e1
|
@ -124,7 +124,7 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon2", {
|
||||||
for _,obj in ipairs(objects) do
|
for _,obj in ipairs(objects) do
|
||||||
local name = self.name
|
local name = self.name
|
||||||
if name~="mobs_mc:roar_of_the_dragon2" and name ~= "mobs_mc:enderdragon" then
|
if name~="mobs_mc:roar_of_the_dragon2" and name ~= "mobs_mc:enderdragon" then
|
||||||
obj:set_hp(obj:get_hp()-0.05)
|
obj:set_hp(obj:get_hp()-5)
|
||||||
if (obj:get_hp() <= 0) then
|
if (obj:get_hp() <= 0) then
|
||||||
if (not obj:is_player()) and name ~= self.object:get_luaentity().name then
|
if (not obj:is_player()) and name ~= self.object:get_luaentity().name then
|
||||||
obj:remove()
|
obj:remove()
|
||||||
|
|
|
@ -94,7 +94,7 @@ mobs:register_arrow("mobs_mc:roar_of_the_dragon", {
|
||||||
for _,obj in ipairs(objects) do
|
for _,obj in ipairs(objects) do
|
||||||
local name = self.name
|
local name = self.name
|
||||||
if name~="mobs_mc:roar_of_the_dragon" and name ~= "mobs_mc:wither" then
|
if name~="mobs_mc:roar_of_the_dragon" and name ~= "mobs_mc:wither" then
|
||||||
obj:set_hp(obj:get_hp()-0.05)
|
obj:set_hp(obj:get_hp()-5)
|
||||||
if (obj:get_hp() <= 0) then
|
if (obj:get_hp() <= 0) then
|
||||||
if (not obj:is_player()) and name ~= self.object:get_luaentity().name then
|
if (not obj:is_player()) and name ~= self.object:get_luaentity().name then
|
||||||
obj:remove()
|
obj:remove()
|
||||||
|
|
|
@ -28,9 +28,6 @@ local msgs = {
|
||||||
S("%s drowned."),
|
S("%s drowned."),
|
||||||
S("%s ran out of oxygen."),
|
S("%s ran out of oxygen."),
|
||||||
},
|
},
|
||||||
["starve"] = {
|
|
||||||
S("%s starved."),
|
|
||||||
},
|
|
||||||
["murder"] = {
|
["murder"] = {
|
||||||
S("%s was killed by %s."),
|
S("%s was killed by %s."),
|
||||||
},
|
},
|
||||||
|
@ -42,13 +39,13 @@ local msgs = {
|
||||||
S("%s was killed by a fireball from a blaze."),
|
S("%s was killed by a fireball from a blaze."),
|
||||||
},
|
},
|
||||||
["fire_charge"] = {
|
["fire_charge"] = {
|
||||||
S("%s was hit by a fire charge."),
|
S("%s was burned by a fire charge."),
|
||||||
},
|
},
|
||||||
["ghast_fireball"] = {
|
["ghast_fireball"] = {
|
||||||
S("A ghast scared %s to death."),
|
S("A ghast scared %s to death."),
|
||||||
S("%s has been fireballed by a ghast."),
|
S("%s has been fireballed by a ghast."),
|
||||||
},
|
},
|
||||||
["fall_damage"] = {
|
["fall"] = {
|
||||||
S("%s fell from a high cliff."),
|
S("%s fell from a high cliff."),
|
||||||
S("%s took fatal fall damage."),
|
S("%s took fatal fall damage."),
|
||||||
S("%s fell victim to gravity."),
|
S("%s fell victim to gravity."),
|
||||||
|
@ -117,132 +114,123 @@ end
|
||||||
|
|
||||||
local last_damages = { }
|
local last_damages = { }
|
||||||
|
|
||||||
minetest.register_on_dieplayer(function(player)
|
minetest.register_on_dieplayer(function(player, reason)
|
||||||
-- Death message
|
-- Death message
|
||||||
local message = minetest.settings:get_bool("mcl_showDeathMessages")
|
local message = minetest.settings:get_bool("mcl_showDeathMessages")
|
||||||
if message == nil then message = true end
|
if message == nil then
|
||||||
|
message = true
|
||||||
|
end
|
||||||
if message then
|
if message then
|
||||||
local name = player:get_player_name()
|
local name = player:get_player_name()
|
||||||
if not name then
|
if not name then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local node = minetest.registered_nodes[minetest.get_node(player:get_pos()).name]
|
|
||||||
local msg
|
local msg
|
||||||
|
if 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
|
||||||
|
-- just barely touching the node with the head)
|
||||||
|
local posses = { pos, {x=pos.x,y=pos.y+1,z=pos.z}, {x=pos.x,y=pos.y+2,z=pos.z}}
|
||||||
|
for p=1, #posses do
|
||||||
|
local node = minetest.registered_nodes[minetest.get_node(posses[p]).name]
|
||||||
-- Lava
|
-- Lava
|
||||||
if minetest.get_item_group(node.name, "lava") ~= 0 then
|
if minetest.get_item_group(node.name, "lava") ~= 0 then
|
||||||
msg = dmsg("lava", name)
|
msg = dmsg("lava", name)
|
||||||
-- Drowning
|
break
|
||||||
elseif player:get_breath() == 0 then
|
|
||||||
msg = dmsg("drown", name)
|
|
||||||
-- Fire
|
-- Fire
|
||||||
elseif minetest.get_item_group(node.name, "fire") ~= 0 then
|
elseif minetest.get_item_group(node.name, "fire") ~= 0 then
|
||||||
msg = dmsg("fire", name)
|
msg = dmsg("fire", name)
|
||||||
-- Other
|
break
|
||||||
else
|
|
||||||
-- Killed by entity
|
|
||||||
if last_damages[name] then
|
|
||||||
-- Mob
|
|
||||||
if last_damages[name].hittertype == "mob" then
|
|
||||||
if last_damages[name].hittername then
|
|
||||||
msg = dmsg("murder", name, last_damages[name].hittername)
|
|
||||||
else
|
|
||||||
msg = mmsg(last_damages[name].hittersubtype, name)
|
|
||||||
end
|
|
||||||
-- Player
|
|
||||||
elseif last_damages[name].hittertype == "player" then
|
|
||||||
if last_damages[name].hittername == name then
|
|
||||||
-- Workaround when player somehow punches self. Caused by creeper explosions in mobs mod.
|
|
||||||
-- FIXME: Remove when self-punching is no longer buggy.
|
|
||||||
msg = dmsg("other", name)
|
|
||||||
else
|
|
||||||
msg = dmsg("murder", name, last_damages[name].hittername)
|
|
||||||
end
|
|
||||||
-- Arrow
|
|
||||||
elseif last_damages[name].hittertype == "arrow" then
|
|
||||||
if last_damages[name].shooter == nil then
|
|
||||||
msg = dmsg("arrow", name)
|
|
||||||
elseif last_damages[name].shooter:is_player() then
|
|
||||||
msg = dmsg("arrow_name", name, last_damages[name].shooter:get_player_name())
|
|
||||||
elseif last_damages[name].shooter:get_luaentity()._cmi_is_mob then
|
|
||||||
if last_damages[name].shooter:get_luaentity().nametag ~= "" then
|
|
||||||
msg = dmsg("arrow_name", name, last_damages[name].shooter:get_player_name())
|
|
||||||
else
|
|
||||||
msg = dmsg("arrow", name)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
msg = dmsg("arrow", name)
|
|
||||||
end
|
|
||||||
-- Fireball
|
|
||||||
elseif last_damages[name].hittertype == "blaze_fireball" then
|
|
||||||
msg = dmsg("blaze_fireball", name)
|
|
||||||
elseif last_damages[name].hittertype == "ghast_fireball" then
|
|
||||||
msg = dmsg("ghast_fireball", name)
|
|
||||||
elseif last_damages[name].hittertype == "fire_charge" then
|
|
||||||
msg = dmsg("fire_charge", name)
|
|
||||||
-- Custom death message
|
|
||||||
elseif last_damages[name].custom then
|
|
||||||
msg = last_damages[name].message
|
|
||||||
end
|
|
||||||
-- Other reason
|
|
||||||
else
|
|
||||||
msg = dmsg("other", name)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if msg then
|
elseif reason.type == "drown" then
|
||||||
minetest.chat_send_all(msg)
|
msg = dmsg("drown", name)
|
||||||
end
|
elseif reason.type == "punch" then
|
||||||
end
|
-- Punches
|
||||||
end)
|
local hitter = reason.object
|
||||||
|
|
||||||
local start_damage_reset_countdown = function (player)
|
|
||||||
minetest.after(1, function(playername)
|
|
||||||
last_damages[playername] = nil
|
|
||||||
end, player:get_player_name())
|
|
||||||
end
|
|
||||||
|
|
||||||
minetest.register_on_punchplayer(function(player, hitter)
|
|
||||||
if not player or not player:is_player() or not hitter then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local msg
|
|
||||||
local hittername, hittertype, hittersubtype, shooter
|
local hittername, hittertype, hittersubtype, shooter
|
||||||
|
-- Unknown hitter
|
||||||
|
if hitter == nil then
|
||||||
|
msg = dmsg("murder_any")
|
||||||
-- Player
|
-- Player
|
||||||
if hitter:is_player() then
|
elseif hitter:is_player() then
|
||||||
hittername = hitter:get_player_name()
|
hittername = hitter:get_player_name()
|
||||||
hittertype = "player"
|
if hittername ~= nil then
|
||||||
|
msg = dmsg("murder", name, hittername)
|
||||||
|
else
|
||||||
|
msg = dmsg("murder_any", name)
|
||||||
|
end
|
||||||
-- Mob (according to Common Mob Interface)
|
-- Mob (according to Common Mob Interface)
|
||||||
elseif hitter:get_luaentity()._cmi_is_mob then
|
elseif hitter:get_luaentity()._cmi_is_mob then
|
||||||
if hitter:get_luaentity().nametag and hitter:get_luaentity().nametag ~= "" then
|
if hitter:get_luaentity().nametag and hitter:get_luaentity().nametag ~= "" then
|
||||||
hittername = hitter:get_luaentity().nametag
|
hittername = hitter:get_luaentity().nametag
|
||||||
end
|
end
|
||||||
hittertype = "mob"
|
|
||||||
hittersubtype = hitter:get_luaentity().name
|
hittersubtype = hitter:get_luaentity().name
|
||||||
|
if hittername then
|
||||||
|
msg = dmsg("murder", name, hittername)
|
||||||
|
elseif hittersubtype ~= nil and hittersubtype ~= "" then
|
||||||
|
msg = mmsg(hittersubtype, name)
|
||||||
|
else
|
||||||
|
msg = dmsg("murder_any", name)
|
||||||
|
end
|
||||||
-- Arrow
|
-- Arrow
|
||||||
elseif hitter:get_luaentity().name == "mcl_bows:arrow_entity" or hitter:get_luaentity().name == "mobs_mc:arrow_entity" then
|
elseif hitter:get_luaentity().name == "mcl_bows:arrow_entity" or hitter:get_luaentity().name == "mobs_mc:arrow_entity" then
|
||||||
hittertype = "arrow"
|
local shooter
|
||||||
if hitter:get_luaentity()._shooter then
|
if hitter:get_luaentity()._shooter then
|
||||||
shooter = hitter:get_luaentity()._shooter
|
shooter = hitter:get_luaentity()._shooter
|
||||||
end
|
end
|
||||||
|
if shooter == nil then
|
||||||
|
msg = dmsg("arrow", name)
|
||||||
|
elseif shooter:is_player() then
|
||||||
|
msg = dmsg("arrow_name", name, shooter:get_player_name())
|
||||||
|
elseif shooter:get_luaentity()._cmi_is_mob then
|
||||||
|
if shooter:get_luaentity().nametag ~= "" then
|
||||||
|
msg = dmsg("arrow_name", name, shooter:get_player_name())
|
||||||
|
else
|
||||||
|
msg = dmsg("arrow", name)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
msg = dmsg("arrow", name)
|
||||||
|
end
|
||||||
-- Blaze fireball
|
-- Blaze fireball
|
||||||
elseif hitter:get_luaentity().name == "mobs_mc:blaze_fireball" then
|
elseif hitter:get_luaentity().name == "mobs_mc:blaze_fireball" then
|
||||||
if hitter:get_luaentity()._shot_from_dispenser then
|
if hitter:get_luaentity()._shot_from_dispenser then
|
||||||
hittertype = "fire_charge"
|
msg = dmsg("fire_charge", name)
|
||||||
else
|
else
|
||||||
hittertype = "blaze_fireball"
|
msg = dmsg("blaze_fireball", name)
|
||||||
end
|
end
|
||||||
-- Ghast fireball
|
-- Ghast fireball
|
||||||
elseif hitter:get_luaentity().name == "mobs_monster:fireball" then
|
elseif hitter:get_luaentity().name == "mobs_monster:fireball" then
|
||||||
hittertype = "ghast_fireball"
|
msg = dmsg("ghast_fireball", name)
|
||||||
else
|
end
|
||||||
return
|
-- Falling
|
||||||
|
elseif reason.type == "fall" then
|
||||||
|
msg = dmsg("fall", name)
|
||||||
|
-- Other
|
||||||
|
elseif reason.type == "set_hp" then
|
||||||
|
if last_damages[name] and last_damages[name].custom then
|
||||||
|
msg = last_damages[name].message
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not msg then
|
||||||
|
msg = dmsg("other", name)
|
||||||
|
end
|
||||||
|
minetest.chat_send_all(msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
last_damages[player:get_player_name()] = { shooter = shooter, hittername = hittername, hittertype = hittertype, hittersubtype = hittersubtype }
|
|
||||||
start_damage_reset_countdown(player)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- To be called BEFORE damaging a player. If the player died, then message will be used as the death message.
|
local start_damage_reset_countdown = function (player)
|
||||||
|
minetest.after(1, function(playername)
|
||||||
|
-- FIXME: Fix race condition with many damages in quick succession
|
||||||
|
if last_damages[playername] and last_damages[playername].custom then
|
||||||
|
last_damages[playername] = nil
|
||||||
|
end
|
||||||
|
end, player:get_player_name())
|
||||||
|
end
|
||||||
|
|
||||||
|
-- To be called BEFORE damaging a player via set_hp. The next time the player dies due to a set_hp,
|
||||||
|
-- the message will be shown. This must happen within one second, otherwise it won't work.
|
||||||
function mcl_death_messages.player_damage(player, message)
|
function mcl_death_messages.player_damage(player, message)
|
||||||
last_damages[player:get_player_name()] = { custom = true, message = message }
|
last_damages[player:get_player_name()] = { custom = true, message = message }
|
||||||
start_damage_reset_countdown(player)
|
start_damage_reset_countdown(player)
|
||||||
|
|
|
@ -2,6 +2,6 @@ mcl_core
|
||||||
mcl_sounds
|
mcl_sounds
|
||||||
mcl_util
|
mcl_util
|
||||||
walkover
|
walkover
|
||||||
mcl_death_messages
|
mcl_death_messages?
|
||||||
doc_items
|
doc_items
|
||||||
doc?
|
doc?
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
local S = minetest.get_translator("mcl_nether")
|
local S = minetest.get_translator("mcl_nether")
|
||||||
|
|
||||||
|
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
|
||||||
|
|
||||||
minetest.register_node("mcl_nether:glowstone", {
|
minetest.register_node("mcl_nether:glowstone", {
|
||||||
description = S("Glowstone"),
|
description = S("Glowstone"),
|
||||||
_doc_items_longdesc = S("Glowstone is a naturally-glowing block which is home to the Nether."),
|
_doc_items_longdesc = S("Glowstone is a naturally-glowing block which is home to the Nether."),
|
||||||
|
@ -91,7 +93,9 @@ minetest.register_node("mcl_nether:magma", {
|
||||||
on_walk_over = function(loc, nodeiamon, player)
|
on_walk_over = function(loc, nodeiamon, player)
|
||||||
-- Hurt players standing on top of this block
|
-- Hurt players standing on top of this block
|
||||||
if player:get_hp() > 0 then
|
if player:get_hp() > 0 then
|
||||||
|
if mod_death_messages then
|
||||||
mcl_death_messages.player_damage(player, string.format("%s stood too long on a magma block.", player:get_player_name()))
|
mcl_death_messages.player_damage(player, string.format("%s 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)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
mcl_throwing = {}
|
mcl_throwing = {}
|
||||||
|
|
||||||
local S = minetest.get_translator("mcl_throwing")
|
local S = minetest.get_translator("mcl_throwing")
|
||||||
|
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Snowballs and other throwable items
|
-- Snowballs and other throwable items
|
||||||
|
@ -267,6 +268,10 @@ local pearl_on_step = function(self, dtime)
|
||||||
local oldpos = player:get_pos()
|
local oldpos = player:get_pos()
|
||||||
-- Teleport and hurt player
|
-- Teleport and hurt player
|
||||||
player:set_pos(telepos)
|
player:set_pos(telepos)
|
||||||
|
if mod_death_messages then
|
||||||
|
mcl_death_messages.player_damage(player, S("@1 used the ender pearl too often.", player:get_player_name()))
|
||||||
|
end
|
||||||
|
-- TODO: Deal as fall damage
|
||||||
player:set_hp(player:get_hp() - 5)
|
player:set_hp(player:get_hp() - 5)
|
||||||
|
|
||||||
-- 5% chance to spawn endermite at the player's origin
|
-- 5% chance to spawn endermite at the player's origin
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
mcl_death_messages?
|
|
@ -2,6 +2,8 @@ local minecraftaliases = true
|
||||||
|
|
||||||
local S = minetest.get_translator("mcl_commands")
|
local S = minetest.get_translator("mcl_commands")
|
||||||
|
|
||||||
|
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
|
||||||
|
|
||||||
local function handle_kill_command(suspect, victim)
|
local function handle_kill_command(suspect, victim)
|
||||||
if minetest.settings:get_bool("enable_damage") == false then
|
if minetest.settings:get_bool("enable_damage") == false then
|
||||||
return false, S("Players can't be killed right now, damage has been disabled.")
|
return false, S("Players can't be killed right now, damage has been disabled.")
|
||||||
|
@ -16,17 +18,29 @@ local function handle_kill_command(suspect, victim)
|
||||||
return false, S("@1 is already dead", victim)
|
return false, S("@1 is already dead", victim)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if not suspect == victim then
|
|
||||||
minetest.log("action", S("@1 killed @2", suspect, victim))
|
|
||||||
end
|
|
||||||
-- If player holds a totem of undying, destroy it before killing,
|
-- If player holds a totem of undying, destroy it before killing,
|
||||||
-- so it doesn't rescue the player.
|
-- so it doesn't rescue the player.
|
||||||
local wield = victimref:get_wielded_item()
|
local wield = victimref:get_wielded_item()
|
||||||
if wield:get_name() == "mobs_mc:totem" then
|
if wield:get_name() == "mobs_mc:totem" then
|
||||||
victimref:set_wielded_item("")
|
victimref:set_wielded_item("")
|
||||||
end
|
end
|
||||||
|
if mod_death_messages then
|
||||||
|
local msg
|
||||||
|
if suspect == victim then
|
||||||
|
msg = S("@1 committed suicide.", victim)
|
||||||
|
else
|
||||||
|
msg = S("@1 was killed by @2.", victim, suspect)
|
||||||
|
end
|
||||||
|
mcl_death_messages.player_damage(victimref, msg)
|
||||||
|
end
|
||||||
-- DIE!
|
-- DIE!
|
||||||
victimref:set_hp(0)
|
victimref:set_hp(0)
|
||||||
|
-- Log
|
||||||
|
if not suspect == victim then
|
||||||
|
minetest.log("action", string.format("%s killed %s using /kill", suspect, victim))
|
||||||
|
else
|
||||||
|
minetest.log("action", string.format("%s committed suicide using /kill", victim))
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
hudbars
|
hudbars
|
||||||
intllib?
|
mcl_death_messages?
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
local S = minetest.get_translator("mcl_hunger")
|
||||||
|
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
|
||||||
|
|
||||||
-- wrapper for minetest.item_eat (this way we make sure other mods can't break this one)
|
-- wrapper for minetest.item_eat (this way we make sure other mods can't break this one)
|
||||||
local org_eat = minetest.do_item_eat
|
local org_eat = minetest.do_item_eat
|
||||||
minetest.do_item_eat = function(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
minetest.do_item_eat = function(hp_change, replace_with_item, itemstack, user, pointed_thing)
|
||||||
|
@ -110,7 +113,11 @@ local function poisonp(tick, time, time_left, damage, exhaustion, name)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Deal damage and exhaust player
|
-- Deal damage and exhaust player
|
||||||
|
-- TODO: Introduce fatal poison at higher difficulties
|
||||||
if player:get_hp()-damage > 0 then
|
if player:get_hp()-damage > 0 then
|
||||||
|
if mod_death_messages then
|
||||||
|
mcl_death_messages.player_damage(player, S("@1 succumbed to the poison."), name)
|
||||||
|
end
|
||||||
player:set_hp(player:get_hp()-damage)
|
player:set_hp(player:get_hp()-damage)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,5 @@
|
||||||
local S
|
local S = minetest.get_translator("mcl_hunger")
|
||||||
if (minetest.get_modpath("intllib")) then
|
local mod_death_messages = minetest.get_modpath("mcl_death_messages")
|
||||||
S = intllib.Getter()
|
|
||||||
else
|
|
||||||
S = function ( s ) return s end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
mcl_hunger = {}
|
mcl_hunger = {}
|
||||||
|
|
||||||
|
@ -172,7 +167,11 @@ minetest.register_globalstep(function(dtime)
|
||||||
mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player))
|
mcl_hunger.update_exhaustion_hud(player, mcl_hunger.get_exhaustion(player))
|
||||||
elseif h == 0 then
|
elseif h == 0 then
|
||||||
-- Damage hungry player down to 1 HP
|
-- Damage hungry player down to 1 HP
|
||||||
|
-- TODO: Allow starvation at higher difficulty levels
|
||||||
if hp-1 > 0 then
|
if hp-1 > 0 then
|
||||||
|
if mod_death_messages then
|
||||||
|
mcl_death_messages.player_damage(player, S("@1 starved to death."), name)
|
||||||
|
end
|
||||||
player:set_hp(hp-1)
|
player:set_hp(hp-1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
local S = minetest.get_translator("mcl_playerplus")
|
||||||
|
|
||||||
-- Internal player state
|
-- Internal player state
|
||||||
local mcl_playerplus_internal = {}
|
local mcl_playerplus_internal = {}
|
||||||
|
|
||||||
|
@ -118,7 +120,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
-- Check privilege, too
|
-- Check privilege, too
|
||||||
and (not minetest.check_player_privs(name, {noclip = true})) then
|
and (not minetest.check_player_privs(name, {noclip = true})) then
|
||||||
if player:get_hp() > 0 then
|
if player:get_hp() > 0 then
|
||||||
mcl_death_messages.player_damage(player, string.format("%s suffocated to death.", name))
|
mcl_death_messages.player_damage(player, S("@1 suffocated to death.", name))
|
||||||
player:set_hp(player:get_hp() - 1)
|
player:set_hp(player:get_hp() - 1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -134,7 +136,7 @@ minetest.register_globalstep(function(dtime)
|
||||||
local dist_feet = vector.distance({x=pos.x, y=pos.y-1, z=pos.z}, near)
|
local dist_feet = vector.distance({x=pos.x, y=pos.y-1, z=pos.z}, near)
|
||||||
if dist < 1.1 or dist_feet < 1.1 then
|
if dist < 1.1 or dist_feet < 1.1 then
|
||||||
if player:get_hp() > 0 then
|
if player:get_hp() > 0 then
|
||||||
mcl_death_messages.player_damage(player, string.format("%s was prickled by a cactus.", name))
|
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)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue