Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent HUD elements from getting stuck on the player's screen #27

Merged
merged 3 commits into from Jun 19, 2022
Merged

Prevent HUD elements from getting stuck on the player's screen #27

merged 3 commits into from Jun 19, 2022

Conversation

fluxionary
Copy link
Contributor

@fluxionary fluxionary commented Feb 7, 2022

Currently, on occasion, the tool "health bar" gets stuck on the screen, and won't go away.

screenshot_20220207_090408

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.

Copy link
Member

@SmallJoker SmallJoker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does what it promises.
Will merge in a few days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants