From e32d7794b76bb55221fa0fc93adba9a708752ba0 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Wed, 13 Sep 2023 00:21:46 -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 6aa106140..54c05dd6c 100644 --- a/builtin/game/statbars.lua +++ b/builtin/game/statbars.lua @@ -160,6 +160,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)