mirror of
https://repo.or.cz/minetest_hudbars.git
synced 2024-11-28 01:53:46 +01:00
Fix hotbar issue when damage is disabled
This commit is contained in:
parent
bc44390984
commit
5effdfca1a
4
init.lua
4
init.lua
@ -192,12 +192,12 @@ end)
|
|||||||
local timer = 0
|
local timer = 0
|
||||||
local timer2 = 0
|
local timer2 = 0
|
||||||
minetest.after(2.5, function()
|
minetest.after(2.5, function()
|
||||||
if minetest.setting_getbool("enable_damage") then
|
|
||||||
minetest.register_globalstep(function(dtime)
|
minetest.register_globalstep(function(dtime)
|
||||||
timer = timer + dtime
|
timer = timer + dtime
|
||||||
timer2 = timer2 + dtime
|
timer2 = timer2 + dtime
|
||||||
for _,player in ipairs(minetest.get_connected_players()) do
|
for _,player in ipairs(minetest.get_connected_players()) do
|
||||||
update_fast(player)
|
update_fast(player)
|
||||||
|
if minetest.setting_getbool("enable_damage") then
|
||||||
local h = tonumber(hud.hunger[player:get_player_name()])
|
local h = tonumber(hud.hunger[player:get_player_name()])
|
||||||
if HUD_ENABLE_HUNGER and timer > 4 then
|
if HUD_ENABLE_HUNGER and timer > 4 then
|
||||||
if h>=16 then
|
if h>=16 then
|
||||||
@ -215,10 +215,10 @@ if minetest.setting_getbool("enable_damage") then
|
|||||||
end
|
end
|
||||||
update_hud(player)
|
update_hud(player)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if timer>4 then timer=0 end
|
if timer>4 then timer=0 end
|
||||||
if timer2>HUD_HUNGER_TICK then timer2=0 end
|
if timer2>HUD_HUNGER_TICK then timer2=0 end
|
||||||
end)
|
end)
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if HUD_ENABLE_HUNGER then dofile(minetest.get_modpath("hud").."/hunger.lua") end
|
if HUD_ENABLE_HUNGER then dofile(minetest.get_modpath("hud").."/hunger.lua") end
|
||||||
|
Loading…
Reference in New Issue
Block a user