Prevent HUD elements from getting stuck on the player's screen #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, on occasion, the tool "health bar" gets stuck on the screen, and won't go away.
How to reproduce:
/create_lag 3000000 3
command from my fork of mesecons_debug to create 3-second lag spikes for 1 in 3 server ticks)Result: A red/green bar in the center of the screen, that won't go away until I relog.
I think the cause of this is lag, coupled w/ the order that HUD create/destroy packets are sent to the client.
The fix is to update the HUD instead of stacking new HUDs on top of each other, and to remove the HUD with a globalstep instead of
minetest.after()
.I've only tested this with a 5.4.1 client/server (on linux), as I haven't yet found/built a 5.5 binary that doesn't crash immediately whenever I launch it.(EDIT: tested w/ 5.5 as well now)I also normalized the code formatting, because it was a hodge-podge of different styles and I didn't know which style to copy. The formatting changes are in 1 commit, the bugfix is in another.