mirror of
https://github.com/4Evergreen4/death_messages.git
synced 2024-08-20 12:34:08 +02:00
Make random messages optional, and add more quips.
This commit is contained in:
parent
d2b31a3ffe
commit
7bcdff90d9
53
init.lua
53
init.lua
@ -3,7 +3,8 @@ local title = "Death Messages"
|
|||||||
local version = "0.1.1"
|
local version = "0.1.1"
|
||||||
local mname = "death_messages"
|
local mname = "death_messages"
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
|
dofile(minetest.get_modpath("death_messages").."/settings.txt")
|
||||||
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- A table of quips for death messages
|
-- A table of quips for death messages
|
||||||
|
|
||||||
@ -13,32 +14,40 @@ local messages = {}
|
|||||||
messages.lava = {
|
messages.lava = {
|
||||||
" thought lava was cool.",
|
" thought lava was cool.",
|
||||||
" melted into a ball of fire.",
|
" 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
|
-- Drowning death messages
|
||||||
messages.water = {
|
messages.water = {
|
||||||
" ran out of air.",
|
" ran out of air.",
|
||||||
" failed at swimming lessons.",
|
" 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
|
-- Burning death messages
|
||||||
messages.fire = {
|
messages.fire = {
|
||||||
" burned to a crisp.",
|
" burned to a crisp.",
|
||||||
" got a little too warm.",
|
" 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
|
-- Other death messages
|
||||||
messages.other = {
|
messages.other = {
|
||||||
" did something fatal.",
|
" did something fatal.",
|
||||||
" died.",
|
" 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)
|
minetest.register_on_dieplayer(function(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
if minetest.is_singleplayer() then
|
if minetest.is_singleplayer() then
|
||||||
player_name = "You"
|
player_name = "You"
|
||||||
@ -50,15 +59,39 @@ minetest.register_on_dieplayer(function(player)
|
|||||||
-- Death by drowning
|
-- Death by drowning
|
||||||
elseif nodename == "default:water_source" or nodename == "default:water_flowing" then
|
elseif nodename == "default:water_source" or nodename == "default:water_flowing" then
|
||||||
minetest.chat_send_all(player_name .. messages.water[math.random(1,#messages.water)] )
|
minetest.chat_send_all(player_name .. messages.water[math.random(1,#messages.water)] )
|
||||||
--Death by fire
|
-- Death by fire
|
||||||
elseif nodename == "fire:basic_flame" then
|
elseif nodename == "fire:basic_flame" then
|
||||||
minetest.chat_send_all(player_name .. messages.fire[math.random(1,#messages.fire)] )
|
minetest.chat_send_all(player_name .. messages.fire[math.random(1,#messages.fire)] )
|
||||||
--Death by something else
|
-- Death by something else
|
||||||
else
|
else
|
||||||
minetest.chat_send_all(player_name .. messages.other[math.random(1,#messages.other)] )
|
minetest.chat_send_all(player_name .. messages.other[math.random(1,#messages.other)] )
|
||||||
end
|
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...")
|
print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
|
||||||
|
1
settings.txt
Normal file
1
settings.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
RANDOM_MESSAGES = true
|
Loading…
Reference in New Issue
Block a user