Currently, on occasion, the tool "health bar" gets stuck on the screen, and won't go away.
How to reproduce:
Put a nearly broken tool on the anvil
Create lag (I use /create_lag 3000000 3 command from my fork of mesecons_debug to create 3-second lag spikes for 1 in 3 server ticks)
Whack the anvil quickly and repeatedly with a hammer
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.
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.