Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Sys Quatre 2020-07-17 23:21:34 +02:00
commit 9cdb3a8ddc
4 changed files with 62 additions and 18 deletions

36
.luacheckrc Normal file
View File

@ -0,0 +1,36 @@
read_globals = {
"DIR_DELIM",
"minetest", "core",
"dump", "dump2",
"vector",
"VoxelManip", "VoxelArea",
"PseudoRandom", "PcgRandom",
"ItemStack",
"Settings",
"unpack",
table = {
fields = {
"copy",
"indexof",
"insert_all",
"key_value_swap",
}
},
string = {
fields = {
"split",
"trim",
}
},
math = {
fields = {
"hypot",
"sign",
"factorial"
}
},
}
max_line_length = 80

View File

@ -7,7 +7,7 @@
A Minetest mod which sends a chat message when a player dies.
Version: 0.1.3
Version: 0.1.4
License: GPL v3 (see LICENSE.txt)
Dependencies:

View File

@ -16,13 +16,13 @@ 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 version = "0.1.2"
local version = "0.1.4"
local mname = "death_messages"
-----------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------
dofile(minetest.get_modpath("death_messages").."/settings.txt")
-----------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- A table of quips for death messages. The first item in each sub table is the
-- default message used when RANDOM_MESSAGES is disabled.
@ -255,9 +255,9 @@ local function find_node(pos, name)
return minetest.find_node_near(pos, 1, name, true)
end
minetest.register_on_dieplayer(
function(player)
minetest.register_on_dieplayer(function(player)
local player_name = player:get_player_name()
local node = minetest.registered_nodes[minetest.get_node(player:get_pos()).name]
if minetest.is_singleplayer() then
player_name = "You"
end
@ -267,20 +267,22 @@ minetest.register_on_dieplayer(
if not whacked[player_name] then
-- Death by lava
if find_node(player:get_pos(), "group:lava") then
if node.groups.lava ~= nil then
death_message = get_message("lava")
-- Death by acid
elseif find_node(player:get_pos(), "group:acid") then
elseif node.groups.acid ~= nil then
death_message = get_message("acid")
-- Death by drowning
elseif player:get_breath() == 0 and find_node(player:get_pos(), "group:water") then
death_message = get_message("water")
elseif player:get_breath() == 0 then
if node.groups.water ~= nil then
death_message = get_message("water")
-- Death in quicksand
elseif node.name == "nalc:sand_source" or node.name == "nalc:sand_flowing" then
death_message = get_message("sand")
end
-- Death by fire
elseif find_node(player:get_pos(), "fire:basic_flame") then
elseif node.name == "fire:basic_flame" then
death_message = get_message("fire")
-- Death in quicksand
elseif player:get_breath() == 0 and find_node(player:get_pos(), {"nalc:sand_source", "nalc:sand_flowing"}) then
death_message = get_message("sand")
-- Death by something else
else
death_message = get_message("other")
@ -295,6 +297,6 @@ minetest.register_on_dieplayer(
end
end)
-----------------------------------------------------------------------------------------------
minetest.log("action", "[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
-----------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------
print("[Mod] "..title.." ["..version.."] ["..mname.."] Loaded...")
--------------------------------------------------------------------------------

View File

@ -1 +1,7 @@
name = death_messages
title = Death Messages
author = Evergreen
description = Sends a chat message when a player dies (with customizable messages)
license = GPL v3
forum = https://forum.minetest.net/viewtopic.php?t=8821
version = 0.1.4