summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBlockMen <nmuelll@web.de>2013-07-27 12:09:14 +0200
committerBlockMen <nmuelll@web.de>2013-07-27 12:09:14 +0200
commit5effdfca1a7e74e107bd3eff7228784aeac1cde5 (patch)
treed5af5644919dd369bffd1a81563b99a3ed91a0ec
parentbc443909844d51bb7bbcc5e89b61cecbc83e0ee7 (diff)
Fix hotbar issue when damage is disabled
-rw-r--r--init.lua14
1 files changed, 7 insertions, 7 deletions
diff --git a/init.lua b/init.lua
index 6ef7cdb..cfd477a 100644
--- a/init.lua
+++ b/init.lua
@@ -192,33 +192,33 @@ end)
local timer = 0
local timer2 = 0
minetest.after(2.5, function()
-if minetest.setting_getbool("enable_damage") then
minetest.register_globalstep(function(dtime)
timer = timer + dtime
timer2 = timer2 + dtime
for _,player in ipairs(minetest.get_connected_players()) do
update_fast(player)
- local h = tonumber(hud.hunger[player:get_player_name()])
- if HUD_ENABLE_HUNGER and timer > 4 then
+ if minetest.setting_getbool("enable_damage") then
+ local h = tonumber(hud.hunger[player:get_player_name()])
+ if HUD_ENABLE_HUNGER and timer > 4 then
if h>=16 then
player:set_hp(player:get_hp()+1)
elseif h==1 and minetest.setting_getbool("enable_damage") then
if player:get_hp()-1 >= 1 then player:set_hp(player:get_hp()-1) end
end
- end
- if HUD_ENABLE_HUNGER and timer2>HUD_HUNGER_TICK then
+ end
+ if HUD_ENABLE_HUNGER and timer2>HUD_HUNGER_TICK then
if h>1 then
h=h-1
hud.hunger[player:get_player_name()]=h
hud.save_hunger(player)
end
+ end
+ update_hud(player)
end
- update_hud(player)
end
if timer>4 then timer=0 end
if timer2>HUD_HUNGER_TICK then timer2=0 end
end)
-end
end)
if HUD_ENABLE_HUNGER then dofile(minetest.get_modpath("hud").."/hunger.lua") end