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

Scoreboard: Fixed Icons sometimes missing #1382

Merged
merged 10 commits into from
Feb 10, 2024
Merged

Conversation

TimGoll
Copy link
Member

@TimGoll TimGoll commented Feb 8, 2024

This PR fixes the scoreboard being stuck open after an icon is missing. This PR does this in two levels

  • adding a safety check to make sure the scoreboard never stays stuck
  • fixing the root cause that causes the breakage in the first place

The problem

Some entities register custom projectiles (like the boomerang) that are then registered as the inflictor. This breaks our current UI as I expected that the weapon is always a real TTT weapon. The change in this PR searches for an entity with the given name class, if no weapon was found.

image
image

I'm pretty sure that it fixes the two linked issues.

@TimGoll TimGoll added type/bug Something isn't working keepalive labels Feb 8, 2024
lua/ttt2/libraries/bodysearch.lua Outdated Show resolved Hide resolved
@TimGoll TimGoll added this to the v0.13.0b milestone Feb 8, 2024
lua/ttt2/libraries/bodysearch.lua Outdated Show resolved Hide resolved
@EntranceJew
Copy link
Contributor

image
image
image
minor overcorrection

@TimGoll
Copy link
Member Author

TimGoll commented Feb 8, 2024

The latent commit based on a suggestion by @ZenBre4ker should solve this. Are you sure you are on that commit?

@EntranceJew
Copy link
Contributor

image
what's on the branch is on the branch

@TimGoll
Copy link
Member Author

TimGoll commented Feb 8, 2024

I have to test this tomorrow again, but looking at the code I don't see how this could happen

@ZenBre4ker
Copy link
Contributor

Shouldnt there be 5 commits?
grafik

@EntranceJew
Copy link
Contributor

for some reason the pull i performed an hour ago to be made aware of the branch did not include a commit performed over 3 hours ago

image
image
image
image
it isn't getting stuck but the boomerang isn't displaying anymore either

@TimGoll
Copy link
Member Author

TimGoll commented Feb 9, 2024

Oh well, I should test stuff after merging suggestions. No idea why it is broken, but I will take a look. Thanks for testing!

@TimGoll
Copy link
Member Author

TimGoll commented Feb 9, 2024

okay, I fixed and tested it. It works now in both cases.

The problem here was that util.WeaponForClass(data.wep) already does what I want and finds the correct projectile entity, therefore my check failed. The solution therefore is to check if a cached material exists.

Maybe it would be an idea to add material caching to entities as well in the future, I'm not so sure though. Nevertheless, this is a discussion for the future, this fallback for non-cached icons is useful, even if we decide to add caching to entities as this is a good way to prevent issues for edge cases

@EntranceJew
Copy link
Contributor

tested, couldn't find a situation that broke the scoreboard or any equipment that didn't have an attribution, LGTM

@TimGoll TimGoll merged commit 55e3703 into master Feb 10, 2024
4 checks passed
@TimGoll TimGoll deleted the fix-missing-search-icon branch February 10, 2024 10:34
@TimGoll TimGoll mentioned this pull request Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scoreboard stuck and creates errors Custom Weapon Icons Missing from Confirmed Bodies in the Scoreboard
4 participants