-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Add support for statbar “off state” icons #9462
Conversation
Server 5.2, client 5.0. The client will see only "on state", the behavior will not change? |
@sfan5: Done. |
Done, rebased and squashed! |
Weird about the heart thing. Also tested in Minimal with game-provided |
Note that MTG uses the wrong size for both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works.
@Wuzzy2 Would you please be so nice and rebase this PR? |
This is ready now! |
the drawdir logic could be made nicer.. *thinking*
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks better now. PR works.
Two suggestions in the documentation - what do you think about those?
Looks good. |
The new |
@sfan5 Outdated review. Does the PR need any change, or does it still look good? |
Still looks good, you can fix the comment before merge if you want. |
Closes #6030.
This adds support for optional “off state” icons for statbars. “off state icons” can be used to denote the lack of something, like missing hearts or bubbles.
Implementation
This implementation is 100% network-compatible.
The “off state” image is set by using thetext
field of the HUD definition. To add the “off state” image, append a slash to the original texture name, then the additional texture name to thetext
field of the HUD definition. Example:heart.png/heart_gone.png
. Here,heart.png
is the normal icon, andheart_gone.png
is the “off state”. If no slash is found, the background image is disabled.The “maximum value” is set by using the
item
field.For the builtin health bar and breath bar,
health_gone.png
andbreath_gone.png
are used, respectively. Note the default images are empty, so games need to add these images first.Implementation rationale and details
The slash was chosen as this is character is forbidden in most OSes.I would have loved to provide non-empty default
_gone
images, but decided aginst that because adding visible images would break compability of existing games. Existing games don't have those images yet and add default images would not fit well together with the game-providedheart.png
/bubble.png
.Technically, the “off state” does not act as a background of the normal image. Instead, the “off state” icons replace the normal icons. I decided against using overlays because it would have made drawing semitransparent icons (like bubbles) quite annoying.
To do
This PR is ready for review.
How to test
Use this test mod and use the
/statbar
command to generate a random statbar (random image count and direction):Additionally, you want to test the behavior or the builtin health and breath statbars. You need to replace
heart_gone.png
andbubble_gone.png
for testing purposes because the default ones are empty/transparent.