1
0
mirror of https://github.com/4Evergreen4/death_messages.git synced 2024-11-13 13:50:21 +01:00

Make random messages optional, and add more quips.

This commit is contained in:
4Evergreen4 2014-03-19 10:48:40 -04:00
parent 0aaec99963
commit cae9820f81
2 changed files with 59 additions and 25 deletions

View File

@ -3,7 +3,8 @@ local title = "Death Messages"
local version = "0.1.1"
local mname = "death_messages"
-----------------------------------------------------------------------------------------------
dofile(minetest.get_modpath("death_messages").."/settings.txt")
-----------------------------------------------------------------------------------------------
-- A table of quips for death messages
@ -13,52 +14,84 @@ local messages = {}
messages.lava = {
" thought lava was cool.",
" melted into a ball of fire.",
" couldn't resist that warm glow of lava."
" couldn't resist that warm glow of lava.",
" dug straight down.",
" didn't know lava was hot."
}
-- Drowning death messages
messages.water = {
" ran out of air.",
" failed at swimming lessons.",
" tried to impersonate an anchor."
" tried to impersonate an anchor.",
" forgot he wasn't a fish.",
" blew one too many bubbles."
}
-- Burning death messages
messages.fire = {
" burned to a crisp.",
" got a little too warm.",
" got too close to the camp fire."
" got too close to the camp fire.",
" just got roasted , hotdog style.",
" was set aflame. More light that way."
}
-- Other death messages
messages.other = {
" did something fatal.",
" died.",
" gave up on life."
" gave up on life.",
" is somewhat dead now.",
" passed out -permanently."
}
if RANDOM_MESSAGES == true then
minetest.register_on_dieplayer(function(player)
local player_name = player:get_player_name()
if minetest.is_singleplayer() then
player_name = "You"
end
-- Death by lava
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 .. messages.lava[math.random(1,#messages.lava)] )
-- Death by drowning
elseif nodename == "default:water_source" or nodename == "default:water_flowing" then
minetest.chat_send_all(player_name .. messages.water[math.random(1,#messages.water)] )
-- Death by fire
elseif nodename == "fire:basic_flame" then
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
minetest.register_on_dieplayer(function(player)
local player_name = player:get_player_name()
if minetest.is_singleplayer() then
player_name = "You"
end
-- Death by lava
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 .. messages.lava[math.random(1,#messages.lava)] )
-- Death by drowning
elseif nodename == "default:water_source" or nodename == "default:water_flowing" then
minetest.chat_send_all(player_name .. messages.water[math.random(1,#messages.water)] )
--Death by fire
elseif nodename == "fire:basic_flame" then
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)
end)
else
minetest.register_on_dieplayer(function(player)
local player_name = player:get_player_name()
if minetest.is_singleplayer() then
player_name = "You"
end
-- Death by lava
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")
-- Death by drowning
elseif nodename == "default:water_source" or nodename == "default:water_flowing" then
minetest.chat_send_all(player_name .. " ran out of air.")
-- Death by fire
elseif nodename == "fire:basic_flame" then
minetest.chat_send_all(player_name .. " burned to a crisp.")
-- Death by something else
else
minetest.chat_send_all(player_name .. " died.")
end
end)
end
-----------------------------------------------------------------------------------------------
print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")

1
settings.txt Normal file
View File

@ -0,0 +1 @@
RANDOM_MESSAGES = true