Fixes race condition in 'on joinplayer' that causes stat bar bugs.

* related to eea1fdaf25
* related to https://codeberg.org/minenux/minetest-engine-minetest/issues/33
This commit is contained in:
mckaygerhard 2023-09-13 00:21:46 -04:00
parent 600ab5f554
commit e32d7794b7

View File

@ -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)