1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-14 14:30:34 +01:00
server-nalc/mods/death_messages/init.lua

157 lines
5.2 KiB
Lua
Raw Normal View History

2014-10-28 18:01:32 +01:00
-----------------------------------------------------------------------------------------------
local title = "Death Messages"
local version = "0.1.2"
local mname = "death_messages"
-----------------------------------------------------------------------------------------------
dofile(minetest.get_modpath("death_messages").."/settings.txt")
-----------------------------------------------------------------------------------------------
-- A table of quips for death messages
local messages = {}
-- Fill this table with sounds
local sounds = {
[1] = "death_messages_player_1",
2015-06-15 12:16:01 +02:00
[2] = "death_messages_player_2",
}
2014-10-28 18:01:32 +01:00
-- Lava death messages
messages.lava = {
" pensait que la lave etait cool.",
" s'est sentit oblige de toucher la lave.",
" est tombe dans la lave.",
" est mort(e) dans de la lave.",
2015-05-30 11:13:39 +02:00
" ne savait pas que la lave etait vraiment chaude.",
" a detruit l'anneau de Sauron."
2014-10-28 18:01:32 +01:00
}
-- Drowning death messages
messages.water = {
" a manque d'air.",
" a essaye d'usurper l'identite d'une ancre.",
" a oublie qu'il n'etait pas un poisson.",
" a oublier qu'il lui fallait respirer sous l'eau.",
2015-05-30 11:13:39 +02:00
" n'est pas bon en natation.",
" a cherche le secret de la licorne.",
" a oublie son scaphandre."
2014-10-28 18:01:32 +01:00
}
-- Burning death messages
messages.fire = {
" a eut un peu trop chaud.",
" a ete trop pres du feu.",
" vient de se faire rotir.",
" a ete carbonise.",
2015-05-30 11:13:39 +02:00
" s'est prit pour la torche.",
" a allume le feu."
}
-- Acid death messages
messages.acid = {
" a desormais des parties en moins.",
" a decouvert que l'acide c'est fun.",
" a mis sa tete la ou elle a fondu.",
" a decouvert que son corps dans l'acide, c'est comme du sucre dans de l'eau.",
2015-05-30 11:13:39 +02:00
" a cru qu'il se baignait dans du jus de pomme.",
" a donne son corps pour faire une infusion.",
" a bu la mauvaise tasse.",
" a voulu tester la solubilite de son corps dans l'acide."
2014-10-28 18:01:32 +01:00
}
-- Quicksands death messages
messages.sand = {
2015-05-30 11:13:39 +02:00
" a appris que le sable etait moins fluide que l'eau.",
" a rejoint les momies.",
" s'est fait(e) ensevelir.",
" a choisi la voie de la fossilisation."
}
2014-10-28 18:01:32 +01:00
-- Other death messages
messages.other = {
" a fait quelque chose qui lui a ete fatale.",
" est mort(e).",
2014-10-28 18:01:32 +01:00
" n'est plus de ce monde.",
" a rejoint le paradis des mineurs.",
2015-05-30 11:13:39 +02:00
" a perdu la vie.",
" a vu la lumière."
2014-10-28 18:01:32 +01:00
}
local function sound_play_all(dead)
for _, p in ipairs(minetest.get_connected_players()) do
local player_name = p:get_player_name()
if player_name and player_name ~= dead then
minetest.sound_play("death_messages_people_1",{to_player=player_name, gain=soundset.get_gain(player_name,"other")})
end
end
end
2014-10-28 18:01:32 +01:00
if RANDOM_MESSAGES == true then
minetest.register_on_dieplayer(function(player)
local player_name = player:get_player_name()
local node = minetest.registered_nodes[minetest.get_node(player:getpos()).name]
if minetest.is_singleplayer() then
player_name = "You"
end
local death_message = ""
2014-10-28 18:01:32 +01:00
-- Death by lava
if node.groups.lava ~= nil then
death_message = player_name .. messages.lava[math.random(1,#messages.lava)]
-- Death by acid
elseif node.groups.acid ~= nil then
death_message = player_name .. messages.acid[math.random(1,#messages.acid)]
2014-10-28 18:01:32 +01:00
-- Death by drowning
elseif player:get_breath() == 0 and node.groups.water then
death_message = player_name .. messages.water[math.random(1,#messages.water)]
2014-10-28 18:01:32 +01:00
-- Death by fire
elseif node.name == "fire:basic_flame" then
death_message = player_name .. messages.fire[math.random(1,#messages.fire)]
-- Death in quicksand
elseif player:get_breath() == 0 and node.name == "default:sand_source" or node.name == "default:sand_flowing" then
death_message = player_name .. messages.sand[math.random(1,#messages.sand)]
2014-10-28 18:01:32 +01:00
-- Death by something else
else
death_message = player_name .. messages.other[math.random(1,#messages.other)]
2014-10-28 18:01:32 +01:00
end
-- Actually tell something
minetest.chat_send_all(death_message)
2015-06-22 22:18:33 +02:00
if minetest.get_modpath("irc") ~= nil then
irc:say(death_message)
end
minetest.sound_play(sounds[math.random(1,#sounds)],{to_player=player:get_player_name(),gain=soundset.get_gain(player:get_player_name(),"other")})
sound_play_all(player:get_player_name())
2014-10-28 18:01:32 +01:00
end)
2015-06-10 17:14:58 +02:00
2014-10-28 18:01:32 +01:00
else
minetest.register_on_dieplayer(function(player)
local player_name = player:get_player_name()
local node = minetest.registered_nodes[minetest.get_node(player:getpos()).name]
if minetest.is_singleplayer() then
player_name = "You"
end
-- Death by lava
if node.groups.lava ~= nil then
minetest.chat_send_all(player_name .. " melted into a ball of fire")
-- Death by drowning
elseif player:get_breath() == 0 then
minetest.chat_send_all(player_name .. " ran out of air.")
-- Death by fire
elseif node.name == "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
minetest.sound_play(sounds[math.random(1,#sounds)],{to_player=player:get_player_name(),gain=soundset.get_gain(player:get_player_name(),"other")})
sound_play_all(player:get_player_name())
2014-10-28 18:01:32 +01:00
end)
end
-----------------------------------------------------------------------------------------------
minetest.log("action", "[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
2014-10-28 18:01:32 +01:00
-----------------------------------------------------------------------------------------------