diff --git a/LICENSE.txt b/LICENSE.txt index c617638..9cecc1d 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,9 +1,3 @@ - - - Home / Licenses - -GPL v3 - GNU GENERAL PUBLIC LICENSE 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 Public License instead of this License. But first, please read . - -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. diff --git a/README.md b/README.md deleted file mode 100644 index f02f044..0000000 --- a/README.md +++ /dev/null @@ -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 - diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..ec577ed --- /dev/null +++ b/README.txt @@ -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/ diff --git a/description.txt b/description.txt new file mode 100644 index 0000000..6a8d75a --- /dev/null +++ b/description.txt @@ -0,0 +1 @@ +A Minetest mod which sends a chat message when a player dies. diff --git a/init.lua b/init.lua index cc19322..3601c1e 100644 --- a/init.lua +++ b/init.lua @@ -1,17 +1,36 @@ +--[[ +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 . +--]] + ----------------------------------------------------------------------------------------------- -local title = "Death Messages" +local title = "Death Messages" local version = "0.1.2" -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. The first item in each sub table is the +-- default message used when RANDOM_MESSAGES is disabled. local messages = {} -- Lava death messages messages.lava = { + " melted into a ball of fire.", " thought lava was cool.", " melted into a ball of fire.", " couldn't resist that warm glow of lava.", @@ -21,6 +40,7 @@ messages.lava = { -- Drowning death messages messages.water = { + " drowned.", " ran out of air.", " failed at swimming lessons.", " tried to impersonate an anchor.", @@ -33,66 +53,49 @@ messages.fire = { " burned to a crisp.", " got a little too warm.", " got too close to the camp fire.", - " just got roasted , hotdog style.", - " was set aflame. More light that way." + " just got roasted, hotdog style.", + " gout burned up. More light that way." } -- Other death messages messages.other = { - " did something fatal.", " died.", + " did something fatal.", " 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() - 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 .. messages.lava[math.random(1,#messages.lava)] ) - -- Death by drowning - elseif player:get_breath() == 0 then - minetest.chat_send_all(player_name .. messages.water[math.random(1,#messages.water)] ) - -- Death by fire - elseif node.name == "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) - -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 - - end) +function get_message(mtype) + if RANDOM_MESSAGES then + return messages[mtype][math.random(1, #messages[mtype])] + else + return messages[1] -- 1 is the index for the non-random message + end end +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 .. get_message("lava")) + -- Death by drowning + elseif player:get_breath() == 0 then + minetest.chat_send_all(player_name .. get_message("water")) + -- Death by fire + elseif node.name == "fire:basic_flame" then + minetest.chat_send_all(player_name .. get_message("fire")) + -- Death by something else + else + minetest.chat_send_all(player_name .. get_message("other")) + end + +end) + ----------------------------------------------------------------------------------------------- print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...") ----------------------------------------------------------------------------------------------- diff --git a/mod.conf b/mod.conf new file mode 100644 index 0000000..e775487 --- /dev/null +++ b/mod.conf @@ -0,0 +1 @@ +name = death_messages diff --git a/screenshot.png b/screenshot.png new file mode 100644 index 0000000..31a7c62 Binary files /dev/null and b/screenshot.png differ