death_messages/init.lua

32 lines
1.3 KiB
Lua
Raw Normal View History

2014-03-17 18:23:56 +01:00
-----------------------------------------------------------------------------------------------
local title = "Death Messages"
local version = "0.1"
local mname = "death_messages"
-----------------------------------------------------------------------------------------------
minetest.register_on_dieplayer(function(player)
2014-03-17 20:10:44 +01:00
local player_name = player:get_player_name()
if minetest.is_singleplayer() then
player_name = "You"
end
2014-03-17 18:23:56 +01:00
-- Death by lava
2014-03-17 20:10:44 +01:00
local nodename = minetest.get_node(player:getpos()).name
if nodename == "default:lava_source" or nodename == "default:lava_flowing" then
minetest.chat_send_all(player_name .. " melted into a ball of fire.")
2014-03-17 18:23:56 +01:00
-- Death by drowning
2014-03-17 20:10:44 +01:00
elseif nodename == "default:water_source" or nodename == "default:water_flowing" then
minetest.chat_send_all(player_name .. " ran out of air.")
2014-03-17 18:23:56 +01:00
--Death by fire
2014-03-17 20:10:44 +01:00
elseif nodename == "fire:basic_flame" then
minetest.chat_send_all(player_name .. " burned up.")
2014-03-17 18:23:56 +01:00
--Death by something else
else
2014-03-17 20:10:44 +01:00
minetest.chat_send_all(player_name .. " died.")
2014-03-17 18:23:56 +01:00
end
2014-03-17 20:10:44 +01:00
2014-03-17 18:23:56 +01:00
end)
-----------------------------------------------------------------------------------------------
print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
-----------------------------------------------------------------------------------------------