From bd9713ab50b7368e25dc37a37138a2b396bc0726 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 15 Mar 2021 01:33:28 +0100 Subject: [PATCH] fix double calling setting in hudbars globalstep --- mods/HUD/hudbars/init.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/HUD/hudbars/init.lua b/mods/HUD/hudbars/init.lua index e52aa8808..e1ff3f5f1 100644 --- a/mods/HUD/hudbars/init.lua +++ b/mods/HUD/hudbars/init.lua @@ -511,9 +511,9 @@ local function update_health(player) end -- update built-in HUD bars -local function update_hud(player) +local function update_hud(player, has_damage) if not player_exists(player) then return end - if minetest.settings:get_bool("enable_damage") then + if has_damage then if hb.settings.forceload_default_hudbars then hb.unhide_hudbar(player, "health") end @@ -564,10 +564,11 @@ minetest.register_globalstep(function(dtime) if main_timer > hb.settings.tick or timer > 4 then if main_timer > hb.settings.tick then main_timer = 0 end -- only proceed if damage is enabled - if minetest.settings:get_bool("enable_damage") or hb.settings.forceload_default_hudbars then + local has_dmg = minetest.settings:get_bool("enable_damage") + if has_dmg or hb.settings.forceload_default_hudbars then for _, player in pairs(hb.players) do -- update all hud elements - update_hud(player) + update_hud(player, has_dmg) end end end