mirror of
https://github.com/4Evergreen4/death_messages.git
synced 2024-08-19 20:24:04 +02:00
Add random table of quips, and bump version to 0.1.1
This commit is contained in:
parent
02a8670823
commit
d2b31a3ffe
@ -3,6 +3,8 @@ Death Messages
|
|||||||
|
|
||||||
A Minetest mod which sends a chat message when a player dies.
|
A Minetest mod which sends a chat message when a player dies.
|
||||||
|
|
||||||
|
Version: 0.1.1 beta
|
||||||
|
|
||||||
License of source code:
|
License of source code:
|
||||||
CC0 1.0 Universal
|
CC0 1.0 Universal
|
||||||
|
|
||||||
|
44
init.lua
44
init.lua
@ -1,9 +1,43 @@
|
|||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
local title = "Death Messages"
|
local title = "Death Messages"
|
||||||
local version = "0.1"
|
local version = "0.1.1"
|
||||||
local mname = "death_messages"
|
local mname = "death_messages"
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
-- A table of quips for death messages
|
||||||
|
|
||||||
|
local messages = {}
|
||||||
|
|
||||||
|
-- Lava death messages
|
||||||
|
messages.lava = {
|
||||||
|
" thought lava was cool.",
|
||||||
|
" melted into a ball of fire.",
|
||||||
|
" couldn't resist that warm glow of lava."
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Drowning death messages
|
||||||
|
messages.water = {
|
||||||
|
" ran out of air.",
|
||||||
|
" failed at swimming lessons.",
|
||||||
|
" tried to impersonate an anchor."
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Burning death messages
|
||||||
|
messages.fire = {
|
||||||
|
" burned to a crisp.",
|
||||||
|
" got a little too warm.",
|
||||||
|
" got too close to the camp fire."
|
||||||
|
}
|
||||||
|
|
||||||
|
-- Other death messages
|
||||||
|
messages.other = {
|
||||||
|
" did something fatal.",
|
||||||
|
" died.",
|
||||||
|
" gave up on life."
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
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
|
||||||
@ -12,16 +46,16 @@ minetest.register_on_dieplayer(function(player)
|
|||||||
-- Death by lava
|
-- Death by lava
|
||||||
local nodename = minetest.get_node(player:getpos()).name
|
local nodename = minetest.get_node(player:getpos()).name
|
||||||
if nodename == "default:lava_source" or nodename == "default:lava_flowing" then
|
if nodename == "default:lava_source" or nodename == "default:lava_flowing" then
|
||||||
minetest.chat_send_all(player_name .. " melted into a ball of fire.")
|
minetest.chat_send_all(player_name .. messages.lava[math.random(1,#messages.lava)] )
|
||||||
-- 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 .. " ran out of air.")
|
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 .. " burned up.")
|
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 .. " died.")
|
minetest.chat_send_all(player_name .. messages.other[math.random(1,#messages.other)] )
|
||||||
end
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
|
Loading…
Reference in New Issue
Block a user