From ccb41016beecae4d4b087032817269e844791044 Mon Sep 17 00:00:00 2001 From: Brandon Date: Fri, 16 May 2014 18:16:07 -0500 Subject: [PATCH] fix energy and magic replenishing bug --- mods/hud/init.lua | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/mods/hud/init.lua b/mods/hud/init.lua index 8eee507..62e9d86 100644 --- a/mods/hud/init.lua +++ b/mods/hud/init.lua @@ -322,7 +322,18 @@ minetest.after(2.5, function() local name = player:get_player_name() local immortal = minetest.check_player_privs(name, {immortal=true}) -- only proceed if damage is enabled - if minetest.setting_getbool("enable_damage") and not immortal then + if immortal == false then + if stamina_timer > HUD_STAMINA_TICK then + hud.update_stamina(player,name) + stamina_timer = 0 + end + + if magic_timer > HUD_MAGIC_TICK then + magic.update_magic(player,name) + magic_timer = 0 + end + end + if minetest.setting_getbool("enable_damage") and immortal == false then local h = tonumber(hud.hunger[name]) local hp = player:get_hp() if HUD_ENABLE_HUNGER and timer > 4 then @@ -345,15 +356,6 @@ minetest.after(2.5, function() -- update current armor level if HUD_SHOW_ARMOR then hud.get_armor(player) end - if stamina_timer > HUD_STAMINA_TICK then - hud.update_stamina(player,name) - stamina_timer = stamina_timer - HUD_STAMINA_TICK - end - - if magic_timer > HUD_MAGIC_TICK then - magic.update_magic(player,name) - magic_timer = magic_timer - HUD_MAGIC_TICK - end -- update all hud elements update_hud(player) end