add dependency on mod thirsty
parent
e615c1cfa6
commit
7dbae77cd4
|
@ -1,3 +1,4 @@
|
|||
default
|
||||
chat2?
|
||||
stamina?
|
||||
thirsty?
|
||||
|
|
23
init.lua
23
init.lua
|
@ -28,6 +28,12 @@ dofile(minetest.get_modpath("death_messages").."/settings.txt")
|
|||
-----------------------------------------------------------------------------------------------
|
||||
local LANG = minetest.settings:get("language")
|
||||
if not (LANG and (LANG ~= "")) then LANG = "en" end
|
||||
-- check if stamina is used and death may occured by exhausting
|
||||
local mstamina = minetest.get_modpath("stamina")
|
||||
local lstamina = 100
|
||||
-- check if thirsty is used and death may occured by exhausting
|
||||
local mthirsty = minetest.get_modpath("thirsty")
|
||||
local lthirsty = 100
|
||||
|
||||
-- A table of quips for death messages. The first item in each sub table is the
|
||||
-- default message used when RANDOM_MESSAGES is disabled.
|
||||
|
@ -135,6 +141,13 @@ messages.exhausted = {en = {
|
|||
de = {
|
||||
" war erschöpft."
|
||||
}}
|
||||
-- thirst
|
||||
messages.thirst = {en = {
|
||||
" was too thirsty."
|
||||
},
|
||||
de = {
|
||||
" verdurstete."
|
||||
}}
|
||||
|
||||
-- PVP Messages
|
||||
messages.pvp = {en = {
|
||||
|
@ -252,12 +265,12 @@ minetest.register_on_dieplayer(function(player,reason)
|
|||
player_name = "You"
|
||||
end
|
||||
|
||||
-- check if stamina is used and death may occured by exhausting
|
||||
local mstamina = minetest.get_modpath("stamina")
|
||||
local lstamina = 100
|
||||
if mstamina ~= nil then
|
||||
lstamina = get_int_attribute(player, "stamina:level")
|
||||
end
|
||||
if mthirsty ~= nil then
|
||||
lthirsty = thirsty.get_thirst_factor(player)
|
||||
end
|
||||
|
||||
-- Death by lava
|
||||
if node.name == "default:lava_source" then
|
||||
|
@ -302,6 +315,10 @@ minetest.register_on_dieplayer(function(player,reason)
|
|||
minetest.chat_send_all(
|
||||
string.char(0x1b).."(c@#00CED1)"..player_name ..
|
||||
string.char(0x1b).."(c@#ff0000)"..get_message("exhausted"))
|
||||
elseif lthirsty <= 1 then
|
||||
minetest.chat_send_all(
|
||||
string.char(0x1b).."(c@#00CED1)"..player_name ..
|
||||
string.char(0x1b).."(c@#ff0000)"..get_message("thirst"))
|
||||
-- Death by something else
|
||||
else
|
||||
minetest.chat_send_all(
|
||||
|
|
Loading…
Reference in New Issue