diff --git a/exhaust.lua b/exhaust.lua index 8485859..b3c8773 100644 --- a/exhaust.lua +++ b/exhaust.lua @@ -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") diff --git a/init.lua b/init.lua index 1c50868..0194b14 100644 --- a/init.lua +++ b/init.lua @@ -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 diff --git a/textures/farming_dough.png b/textures/farming_dough.png index 4b9ff22..c935d9f 100644 Binary files a/textures/farming_dough.png and b/textures/farming_dough.png differ