minor fixes

This commit is contained in:
OgelGames 2021-06-01 18:37:19 +10:00
parent 5ca11e9390
commit 3d92715e79
3 changed files with 9 additions and 3 deletions

View File

@ -1,10 +1,14 @@
local exhaust_tick = 1000*1000 -- 1 second
local timestamp = {}
stamina.register_on_exhaust_player(function(player, change, reason)
if type(player) ~= "userdata" or reason == "punch" or change < stamina.settings.exhaust_craft then return end
local now = minetest.get_us_time()
local name = player:get_player_name()
if timestamp[name] then
if now - timestamp[name] > 999999 then
if now - timestamp[name] >= exhaust_tick then
if (stamina.get_saturation(player) or 0) <= stamina.settings.starve_lvl then
timestamp[name] = now
player:set_hp(player:get_hp() - 1, "exhaust")

View File

@ -10,7 +10,7 @@ dofile(MP .. "/anticheat/inv_move.lua")
dofile(MP.."/alias.lua")
-- warning message for default password (if set)
if minetest.settings:get("default_password") then
if minetest.settings:get("default_password") ~= "" then
dofile(MP.."/default_password_warn.lua")
end
@ -208,4 +208,6 @@ if minetest.get_modpath("digistuff") then
end
-- stamina extras
dofile(MP.."/exhaust.lua")
if minetest.global_exists("stamina") then
dofile(MP.."/exhaust.lua")
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 193 B