From 02da4d6a59439f35559401be52d9a47cb30382b9 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Wed, 13 Sep 2023 00:15:31 -0400 Subject: [PATCH] Fixes race condition in 'on joinplayer' that causes stat bar bugs. * related to https://github.com/minetest/minetest/commit/eea1fdaf2574fec38316527cfc463ff2427c5775 * related to https://codeberg.org/minenux/minetest-engine-minetest/issues/33 --- builtin/game/statbars.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/builtin/game/statbars.lua b/builtin/game/statbars.lua index a3f66243d..8d1a174bb 100644 --- a/builtin/game/statbars.lua +++ b/builtin/game/statbars.lua @@ -171,6 +171,10 @@ function core.hud_replace_builtin(name, definition) return false end -core.register_on_joinplayer(initialize_builtin_statbars) +-- Append "update_builtin_statbars" as late as possible +-- This ensures that the HUD is hidden when the flags are updated in this callback +core.after(0, function() + core.register_on_joinplayer(initialize_builtin_statbars) +end) core.register_on_leaveplayer(cleanup_builtin_statbars) core.register_playerevent(player_event_handler)