forked from mtcontrib/death_messages
Merge branch 'master' into nalc-1.2.
- Avec correction la personnalisation du mod pour le serveur NALC.
This commit is contained in:
commit
687947b07d
38
LICENSE.txt
38
LICENSE.txt
@ -1,9 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
Home / Licenses
|
|
||||||
|
|
||||||
GPL v3
|
|
||||||
|
|
||||||
GNU GENERAL PUBLIC LICENSE
|
GNU GENERAL PUBLIC LICENSE
|
||||||
Version 3, 29 June 2007
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
@ -678,35 +672,3 @@ may consider it more useful to permit linking proprietary applications with
|
|||||||
the library. If this is what you want to do, use the GNU Lesser General
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
Public License instead of this License. But first, please read
|
Public License instead of this License. But first, please read
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
|
|
||||||
Copy license text to clipboard
|
|
||||||
How to apply this license
|
|
||||||
|
|
||||||
Create a text file (typically named LICENSE or LICENSE.txt) in the root of your source code and copy the text of the license into the file.
|
|
||||||
|
|
||||||
Note: The Free Software Foundation recommends taking the additional step of adding a boilerplate notice to the top of each file. The boilerplate can be found at the end of the license.
|
|
||||||
Source
|
|
||||||
Required
|
|
||||||
|
|
||||||
Disclose Source
|
|
||||||
License and copyright notice
|
|
||||||
State Changes
|
|
||||||
|
|
||||||
Permitted
|
|
||||||
|
|
||||||
Commercial Use
|
|
||||||
Distribution
|
|
||||||
Modification
|
|
||||||
Patent Grant
|
|
||||||
Private Use
|
|
||||||
|
|
||||||
Forbidden
|
|
||||||
|
|
||||||
Hold Liable
|
|
||||||
Sublicensing
|
|
||||||
|
|
||||||
About Terms of Service
|
|
||||||
|
|
||||||
If you have questions or issues, it is always best to consult a legal professional.
|
|
||||||
This site is licensed under the Creative Commons Attribution 3.0 Unported License.
|
|
||||||
Demystified with <3 by GitHub, Inc.
|
|
||||||
|
12
README.md
12
README.md
@ -1,12 +0,0 @@
|
|||||||
Death Messages
|
|
||||||
==============
|
|
||||||
|
|
||||||
A Minetest mod which sends a chat message when a player dies.
|
|
||||||
|
|
||||||
Version: 0.1.2 beta
|
|
||||||
|
|
||||||
License of source code:
|
|
||||||
GPL v3
|
|
||||||
|
|
||||||
See LICENSE.txt for full legal text
|
|
||||||
|
|
17
README.txt
Normal file
17
README.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
____ _ _ __ __
|
||||||
|
| _ \ ___ __ _| |_| |__ | \/ | ___ ___ ___ __ _ __ _ ___ ___
|
||||||
|
| | | |/ _ \/ _` | __| '_ \ | |\/| |/ _ \/ __/ __|/ _` |/ _` |/ _ \/ __|
|
||||||
|
| |_| | __/ (_| | |_| | | | | | | | __/\__ \__ \ (_| | (_| | __/\__ \
|
||||||
|
|____/ \___|\__,_|\__|_| |_| |_| |_|\___||___/___/\__,_|\__, |\___||___/
|
||||||
|
|___/
|
||||||
|
|
||||||
|
A Minetest mod which sends a chat message when a player dies.
|
||||||
|
|
||||||
|
Version: 0.1.3
|
||||||
|
License: GPL v3 (see LICENSE.txt)
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
none
|
||||||
|
|
||||||
|
Please report bugs at the github issue tracker:
|
||||||
|
https://github.com/4Evergreen4/death_messages/issues/
|
1
description.txt
Normal file
1
description.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
A Minetest mod which sends a chat message when a player dies.
|
177
init.lua
177
init.lua
@ -1,12 +1,31 @@
|
|||||||
|
--[[
|
||||||
|
death_messages - A Minetest mod which sends a chat message when a player dies.
|
||||||
|
Copyright (C) 2016 EvergreenTree
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
--]]
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
local title = "Death Messages"
|
local title = "Death Messages"
|
||||||
local version = "0.1.2"
|
local version = "0.1.2"
|
||||||
local mname = "death_messages"
|
local mname = "death_messages"
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
dofile(minetest.get_modpath("death_messages").."/settings.txt")
|
dofile(minetest.get_modpath("death_messages").."/settings.txt")
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
-- A table of quips for death messages
|
-- A table of quips for death messages. The first item in each sub table is the
|
||||||
|
-- default message used when RANDOM_MESSAGES is disabled.
|
||||||
local messages = {}
|
local messages = {}
|
||||||
|
|
||||||
-- Another one to avoid double death messages
|
-- Another one to avoid double death messages
|
||||||
@ -117,39 +136,40 @@ messages.monsters_whacking = {
|
|||||||
-- Monsters
|
-- Monsters
|
||||||
|
|
||||||
local monsters = {
|
local monsters = {
|
||||||
["mobs:fireball"] = "dungeon master",
|
["mobs_monster:fireball"] = "dungeon master",
|
||||||
["mobs:dungeon_master"] = "dungeon master",
|
["mobs_monster:dungeon_master"] = "dungeon master",
|
||||||
["mobs:spider"] = "spider",
|
["mobs_monster:spider"] = "spider",
|
||||||
["mobs:sand_monster"] = "sand monster",
|
["mobs_monster:sand_monster"] = "sand monster",
|
||||||
["mobs:cow"] = "cow",
|
["mobs_animal:cow"] = "cow",
|
||||||
["mobs:creeper"] = "creeper",
|
["creeper:creeper"] = "creeper",
|
||||||
["mobs:dog"] = "dog",
|
["pmobs:dog"] = "dog",
|
||||||
["mobs:greenbig"] = "big green slim",
|
["slimes:greenbig"] = "big green slim",
|
||||||
["mobs:greenmedium"] = "medium green slim",
|
["slimes:greenmedium"] = "medium green slim",
|
||||||
["mobs:greensmall"] = "small green slim",
|
["slimes:greensmall"] = "small green slim",
|
||||||
["mobs:lavabig"] = "big lava slim",
|
["slimes:lavabig"] = "big lava slim",
|
||||||
["mobs:lavamedium"] = "medium lava slim",
|
["slimes:lavamedium"] = "medium lava slim",
|
||||||
["mobs:lavasmall"] = "small lava slim",
|
["slimes:lavasmall"] = "small lava slim",
|
||||||
["mobs:yeti"] = "yeti",
|
["pmobs:yeti"] = "yeti",
|
||||||
["mobs:snowball"] = "yeti",
|
["pmobs:snowball"] = "yeti",
|
||||||
["mobs:npc"] = "npc",
|
["pmobs:npc"] = "npc",
|
||||||
["mobs:npc_female"] = "female npc",
|
["pmobs:npc_female"] = "female npc",
|
||||||
["mobs:oerkki"] = "oerkki",
|
["mobs_monster:oerkki"] = "oerkki",
|
||||||
["mobs:stone_monster"] = "stone monster",
|
["mobs_monster:stone_monster"] = "stone monster",
|
||||||
["mobs:dirt_monster"] = "dirt monster",
|
["mobs_monster:dirt_monster"] = "dirt monster",
|
||||||
["mobs:goat"] = "goat",
|
["mobs_animal:goat"] = "goat",
|
||||||
["mobs:wolf"] = "wolf",
|
["pmobs:wolf"] = "wolf",
|
||||||
["mobs:tree_monster"] = "tree monster",
|
["mobs_monster:tree_monster"] = "tree monster",
|
||||||
["mobs:mese_arrow"] = "mese monster",
|
["mobs_monster:mese_arrow"] = "mese monster",
|
||||||
["mobs:zombie"] = "zombie",
|
["zombie:zombie"] = "zombie",
|
||||||
["mobs:minotaur"] = "minotaur",
|
["mobs_monster:minotaur"] = "minotaur",
|
||||||
["mobs:pumba"] = "warthog",
|
["mobs_animal:pumba"] = "warthog",
|
||||||
["tsm_pyramids:mummy"] = "mummy",
|
["tsm_pyramids:mummy"] = "mummy",
|
||||||
["mobs:shark_lg"] = "large shark",
|
["mobs_sharks:shark_lg"] = "large shark",
|
||||||
["mobs:shark_md"] = "medium shark",
|
["mobs_sharks:shark_md"] = "medium shark",
|
||||||
["mobs:pumpking"] = "pumpking",
|
["mobs_sharks:shark_sm"] = "small shark",
|
||||||
["mobs:pumpboom"] = "pumpboom",
|
-- ["mobs:pumpking"] = "pumpking",
|
||||||
["mobs:mese_dragon"] = "mese_dragon",
|
-- ["mobs:pumpboom"] = "pumpboom",
|
||||||
|
-- ["mobs:mese_dragon"] = "mese_dragon",
|
||||||
}
|
}
|
||||||
|
|
||||||
local function broadcast_death(msg)
|
local function broadcast_death(msg)
|
||||||
@ -166,7 +186,6 @@ local function sound_play_all(dead)
|
|||||||
for _, p in ipairs(minetest.get_connected_players()) do
|
for _, p in ipairs(minetest.get_connected_players()) do
|
||||||
local player_name = p:get_player_name()
|
local player_name = p:get_player_name()
|
||||||
if player_name and player_name ~= dead then
|
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")})
|
|
||||||
minetest.sound_play("death_messages_people_1",{to_player=player_name, gain=1})
|
minetest.sound_play("death_messages_people_1",{to_player=player_name, gain=1})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -184,9 +203,8 @@ minetest.register_on_punchplayer(function(player, hitter, time,
|
|||||||
death_message = string.format(messages.monsters_whacking[math.random(1, #messages.monsters_whacking)], player_name, entity_name, player_name, entity_name)
|
death_message = string.format(messages.monsters_whacking[math.random(1, #messages.monsters_whacking)], player_name, entity_name, player_name, entity_name)
|
||||||
end
|
end
|
||||||
broadcast_death(death_message)
|
broadcast_death(death_message)
|
||||||
-- minetest.sound_play(sounds[math.random(1,#sounds)],{to_player=player:get_player_name(),gain=soundset.get_gain(player:get_player_name(),"other")})
|
minetest.sound_play(sounds[math.random(1,#sounds)],{to_player=player_name,gain=1})
|
||||||
minetest.sound_play(sounds[math.random(1,#sounds)],{to_player=player:get_player_name(),gain=1})
|
sound_play_all(player_name)
|
||||||
sound_play_all(player:get_player_name())
|
|
||||||
whacked[player_name] = true
|
whacked[player_name] = true
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@ -200,10 +218,21 @@ minetest.register_on_respawnplayer(function(player)
|
|||||||
whacked[player:get_player_name()] = nil
|
whacked[player:get_player_name()] = nil
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if RANDOM_MESSAGES == true then
|
local function get_message(mtype)
|
||||||
minetest.register_on_dieplayer(function(player)
|
if RANDOM_MESSAGES then
|
||||||
|
return messages[mtype][math.random(1, #messages[mtype])]
|
||||||
|
else
|
||||||
|
return messages[mtype][1] -- 1 is the index for the non-random message
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function find_node(pos, name)
|
||||||
|
return minetest.find_node_near(pos, 1, name, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_dieplayer(
|
||||||
|
function(player)
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
local node = minetest.registered_nodes[minetest.get_node(player:getpos()).name]
|
|
||||||
if minetest.is_singleplayer() then
|
if minetest.is_singleplayer() then
|
||||||
player_name = "You"
|
player_name = "You"
|
||||||
end
|
end
|
||||||
@ -213,64 +242,34 @@ if RANDOM_MESSAGES == true then
|
|||||||
if not whacked[player_name] then
|
if not whacked[player_name] then
|
||||||
|
|
||||||
-- Death by lava
|
-- Death by lava
|
||||||
if node.groups.lava ~= nil then
|
if find_node(player:get_pos(), "group:lava") then
|
||||||
death_message = messages.lava[math.random(1,#messages.lava)]
|
death_message = get_message("lava")
|
||||||
-- Death by acid
|
-- Death by acid
|
||||||
elseif node.groups.acid ~= nil then
|
elseif find_node(player:get_pos(), "group:acid") then
|
||||||
death_message = messages.acid[math.random(1,#messages.acid)]
|
death_message = get_message("acid")
|
||||||
-- Death by drowning
|
-- Death by drowning
|
||||||
elseif player:get_breath() == 0 and node.groups.water then
|
elseif player:get_breath() == 0 and find_node(player:get_pos(), "group:water") then
|
||||||
death_message = messages.water[math.random(1,#messages.water)]
|
death_message = get_message("water")
|
||||||
-- Death by fire
|
-- Death by fire
|
||||||
elseif node.name == "fire:basic_flame" then
|
elseif find_node(player:get_pos(), "fire:basic_flame") then
|
||||||
death_message = messages.fire[math.random(1,#messages.fire)]
|
death_message = get_message("fire")
|
||||||
-- Death in quicksand
|
-- Death in quicksand
|
||||||
elseif player:get_breath() == 0 and node.name == "default:sand_source" or node.name == "default:sand_flowing" then
|
elseif player:get_breath() == 0 and find_node(player:get_pos(), {"nalc:sand_source", "nalc:sand_flowing"}) then
|
||||||
death_message = messages.sand[math.random(1,#messages.sand)]
|
death_message = get_message("sand")
|
||||||
-- Death by something else
|
-- Death by something else
|
||||||
else
|
else
|
||||||
death_message = messages.other[math.random(1,#messages.other)]
|
death_message = get_message("other")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Actually tell something
|
-- Actually tell something
|
||||||
death_message = string.format(death_message, player_name, player_name)
|
death_message = string.format(death_message, player_name, player_name)
|
||||||
broadcast_death(death_message)
|
broadcast_death(death_message)
|
||||||
-- minetest.sound_play(sounds[math.random(1,#sounds)],{to_player=player_name,gain=soundset.get_gain(player_name, "other")})
|
minetest.sound_play(sounds[math.random(1,#sounds)], {to_player=player_name,gain=1})
|
||||||
minetest.sound_play(sounds[math.random(1,#sounds)],{to_player=player_name,gain=1})
|
|
||||||
sound_play_all(player_name)
|
sound_play_all(player_name)
|
||||||
whacked[player_name] = true
|
whacked[player_name] = true
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
else
|
|
||||||
-- Should we keep that part?
|
|
||||||
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
|
|
||||||
if not whacked[player_name] then
|
|
||||||
-- 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
|
|
||||||
end
|
|
||||||
-- minetest.sound_play(sounds[math.random(1,#sounds)],{to_player=player:get_player_name(),gain=soundset.get_gain(player:get_player_name(),"other")})
|
|
||||||
minetest.sound_play(sounds[math.random(1,#sounds)],{to_player=player:get_player_name(),gain=1})
|
|
||||||
sound_play_all(player:get_player_name())
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
minetest.log("action", "[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
|
minetest.log("action", "[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
|
||||||
-----------------------------------------------------------------------------------------------
|
-----------------------------------------------------------------------------------------------
|
||||||
|
BIN
screenshot.png
Normal file
BIN
screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 68 KiB |
Loading…
Reference in New Issue
Block a user