2014-03-17 18:23:56 +01:00
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
local title = "Death Messages"
|
2014-03-19 15:50:44 +01:00
|
|
|
local version = "0.1.2"
|
2014-03-17 18:23:56 +01:00
|
|
|
local mname = "death_messages"
|
|
|
|
-----------------------------------------------------------------------------------------------
|
2014-03-19 15:48:40 +01:00
|
|
|
dofile(minetest.get_modpath("death_messages").."/settings.txt")
|
|
|
|
-----------------------------------------------------------------------------------------------
|
2014-03-19 01:59:44 +01:00
|
|
|
|
|
|
|
-- A table of quips for death messages
|
|
|
|
|
|
|
|
local messages = {}
|
|
|
|
|
|
|
|
-- Lava death messages
|
|
|
|
messages.lava = {
|
|
|
|
" thought lava was cool.",
|
|
|
|
" melted into a ball of fire.",
|
2014-03-19 15:48:40 +01:00
|
|
|
" couldn't resist that warm glow of lava.",
|
|
|
|
" dug straight down.",
|
|
|
|
" didn't know lava was hot."
|
2014-03-19 01:59:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
-- Drowning death messages
|
|
|
|
messages.water = {
|
|
|
|
" ran out of air.",
|
|
|
|
" failed at swimming lessons.",
|
2014-03-19 15:48:40 +01:00
|
|
|
" tried to impersonate an anchor.",
|
|
|
|
" forgot he wasn't a fish.",
|
|
|
|
" blew one too many bubbles."
|
2014-03-19 01:59:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
-- Burning death messages
|
|
|
|
messages.fire = {
|
|
|
|
" burned to a crisp.",
|
|
|
|
" got a little too warm.",
|
2014-03-19 15:48:40 +01:00
|
|
|
" got too close to the camp fire.",
|
|
|
|
" just got roasted , hotdog style.",
|
|
|
|
" was set aflame. More light that way."
|
2014-03-19 01:59:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
-- Other death messages
|
|
|
|
messages.other = {
|
|
|
|
" did something fatal.",
|
|
|
|
" died.",
|
2014-03-19 15:48:40 +01:00
|
|
|
" gave up on life.",
|
|
|
|
" is somewhat dead now.",
|
|
|
|
" passed out -permanently."
|
2014-03-19 01:59:44 +01:00
|
|
|
}
|
|
|
|
|
2014-03-19 15:48:40 +01:00
|
|
|
if RANDOM_MESSAGES == true then
|
|
|
|
minetest.register_on_dieplayer(function(player)
|
|
|
|
local player_name = player:get_player_name()
|
2014-03-20 12:32:08 +01:00
|
|
|
local node = minetest.registered_nodes[minetest.get_node(player:getpos()).name]
|
2014-03-19 15:48:40 +01:00
|
|
|
if minetest.is_singleplayer() then
|
|
|
|
player_name = "You"
|
|
|
|
end
|
|
|
|
-- Death by lava
|
2014-03-20 12:32:08 +01:00
|
|
|
if node.groups.lava ~= nil then
|
2014-03-19 15:48:40 +01:00
|
|
|
minetest.chat_send_all(player_name .. messages.lava[math.random(1,#messages.lava)] )
|
|
|
|
-- Death by drowning
|
2014-03-20 12:32:08 +01:00
|
|
|
elseif node.groups.water ~= nil then
|
2014-03-19 15:48:40 +01:00
|
|
|
minetest.chat_send_all(player_name .. messages.water[math.random(1,#messages.water)] )
|
|
|
|
-- Death by fire
|
2014-03-20 12:32:08 +01:00
|
|
|
elseif node.name == "fire:basic_flame" then
|
2014-03-19 15:48:40 +01:00
|
|
|
minetest.chat_send_all(player_name .. messages.fire[math.random(1,#messages.fire)] )
|
|
|
|
-- Death by something else
|
|
|
|
else
|
|
|
|
minetest.chat_send_all(player_name .. messages.other[math.random(1,#messages.other)] )
|
|
|
|
end
|
|
|
|
|
|
|
|
end)
|
2014-03-19 01:59:44 +01:00
|
|
|
|
2014-03-19 15:48:40 +01:00
|
|
|
else
|
|
|
|
minetest.register_on_dieplayer(function(player)
|
|
|
|
local player_name = player:get_player_name()
|
2014-03-20 12:32:08 +01:00
|
|
|
local node = minetest.registered_nodes[minetest.get_node(player:getpos()).name]
|
2014-03-19 15:48:40 +01:00
|
|
|
if minetest.is_singleplayer() then
|
|
|
|
player_name = "You"
|
|
|
|
end
|
|
|
|
-- Death by lava
|
2014-03-20 12:32:08 +01:00
|
|
|
if node.groups.lava ~= nil then
|
2014-03-19 15:48:40 +01:00
|
|
|
minetest.chat_send_all(player_name .. " melted into a ball of fire")
|
|
|
|
-- Death by drowning
|
2014-03-20 12:32:08 +01:00
|
|
|
elseif node.groups.water ~= nil then
|
2014-03-19 15:48:40 +01:00
|
|
|
minetest.chat_send_all(player_name .. " ran out of air.")
|
|
|
|
-- Death by fire
|
2014-03-20 12:32:08 +01:00
|
|
|
elseif node.name == "fire:basic_flame" then
|
2014-03-19 15:48:40 +01:00
|
|
|
minetest.chat_send_all(player_name .. " burned to a crisp.")
|
|
|
|
-- Death by something else
|
|
|
|
else
|
|
|
|
minetest.chat_send_all(player_name .. " died.")
|
|
|
|
end
|
2014-03-17 20:10:44 +01:00
|
|
|
|
2014-03-19 15:48:40 +01:00
|
|
|
end)
|
|
|
|
end
|
2014-03-17 18:23:56 +01:00
|
|
|
|
|
|
|
-----------------------------------------------------------------------------------------------
|
|
|
|
print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
|
|
|
|
-----------------------------------------------------------------------------------------------
|