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

Fix breath statbar scaling; defer breath_bar hiding by one second #8271

Merged
merged 1 commit into from Apr 28, 2020

Conversation

ClobberXD
Copy link
Contributor

@ClobberXD ClobberXD commented Feb 22, 2019

PLAYER_MAX_BREATH_DEFAULT is set to 11 instead of 10, probably so that all 10 bubbles are shown before the breath bar disappears. See #8210 (comment) for more details.

This PR sets PLAYER_MAX_BREATH_DEFAULT to 10, and hides the breath bar after a delay of one second, so that all 10 bubbles are visible.

Fixes #8210. Tested.

To test:

  • Start losing breath in a drown-able liquid
  • Regain breath
  • Observe that all 10 bubbles are shown, before the breath bar disappears a second later

@ClobberXD
Copy link
Contributor Author

At the moment, the breath bar does disappear once full. Should I make it permanently visible?

@nerzhul
Copy link
Member

nerzhul commented Feb 22, 2019

breath bar always disappear when full :)

@ClobberXD
Copy link
Contributor Author

breath bar always disappear when full :)

I know, but doesn't that seem inconsistent with the health bar? If this behaviour is correct, shouldn't the health bar disappear when the player has full health as well?

@nerzhul
Copy link
Member

nerzhul commented Feb 22, 2019

i don't think. Health should be shown every time like in many RPG, and breath is only shown when consumed generally, the current behaviour is fine and natural for me

@paramat
Copy link
Contributor

paramat commented Feb 22, 2019

Breath bar disappearing is ok for me, less visual obstruction.

@paramat paramat added the Bugfix 🐛 PRs that fix a bug label Feb 22, 2019
@ghost
Copy link

ghost commented Feb 22, 2019 via email

@SmallJoker
Copy link
Member

Usually you don't care about breath, thus hiding it frees some space for the relevant game screen. I'd like to keep the old behaviour; internally the maximal value could be set to 1 higher so that the HUD may disappear correctly.

@ClobberXD
Copy link
Contributor Author

Makes sense. What do you suggest I do now?

@paramat
Copy link
Contributor

paramat commented Feb 23, 2019

I don't think 10 bubbles should ever appear, if 10 is full then 10 should be invisible. No bar means 10. This 11 thing is silly and messy.

@ghost
Copy link

ghost commented Feb 23, 2019 via email

@paramat
Copy link
Contributor

paramat commented Feb 24, 2019

I don't need to try it i can imagine from current behaviour.
Currently, when at 10 bubbles there is still another breath regain cycle as the 11th is gained, then it disappears at 11. I can see why it was done but it was a bad and messy decision because 11 is a weird and inconsistent number.

@ghost
Copy link

ghost commented Feb 24, 2019 via email

@paramat
Copy link
Contributor

paramat commented Feb 26, 2019

I know, that's what i wrote.

@ghost
Copy link

ghost commented Feb 26, 2019

You wrote that ten shouldn't be visible, which would be a change in current behavior.

@ClobberXD
Copy link
Contributor Author

ClobberXD commented Feb 27, 2019

SmallJoker's suggestion of reducing nominal by 1 doesn't seem like the best long-term solution, as there's still quite a bit of wizardry going on behind the scenes. While we can take this to be a quick-fix for 5.0.0, we could add proper support for statbars to automatically disappear when they are full, in 5.1.0. Support in the sense, there won't be the need to use magical numbers to make sure 10 bubbles appear, and the engine would take care of the hiding part without any intervention by us. :)

@paramat
Copy link
Contributor

paramat commented Mar 1, 2019

Yes i was proposing 10 not being visible, a change of behaviour.

Yes a more careful implementation is probably needed.
This PR won't be merged for 5.0.0 as it's a low-priority visual-only issue.

@ClobberXD
Copy link
Contributor Author

Any thoughts or suggestions as to what's the best way to do this?

@rubenwardy rubenwardy force-pushed the master branch 2 times, most recently from 0e3b135 to 39c54e1 Compare June 21, 2019 00:46
@ClobberXD
Copy link
Contributor Author

On printing a bunch of values, I noticed that the player's breath_max is 11, in spite of having changed PLAYER_MAX_BREATH_DEFAULT to 10. MTG doesn't seem to set breath_max to any value either. This can't be due to old modifications I made when testing this PR, as it's 11 in a new world as well. I'll see if this is initialized somewhere in the engine...

@ClobberXD ClobberXD force-pushed the statbars_fix branch 2 times, most recently from a0417b0 to 4b60dec Compare August 2, 2019 07:38
@ClobberXD
Copy link
Contributor Author

ClobberXD commented Aug 2, 2019

It seems like I just didn't re-compile after setting PLAYER_MAX_BREATH_DEFAULT to 10. It works now. All 10 bubbles are displayed, and if the bar is full, it is hidden one second later.

This PR now works, and is ready for review. :)

@SmallJoker @paramat

@ClobberXD ClobberXD changed the title Fix extra bubbles being displayed for high breath_max values Fix breath_bar scaling; delay breath_bar hiding by one second Aug 2, 2019
@ClobberXD ClobberXD force-pushed the statbars_fix branch 2 times, most recently from ca11b5c to 28006bd Compare August 2, 2019 08:03
@ClobberXD ClobberXD changed the title Fix breath_bar scaling; delay breath_bar hiding by one second Fix breath statbar scaling; defer breath_bar hiding by one second Aug 2, 2019
@ClobberXD
Copy link
Contributor Author

PR's ready for review (again). Tested by toggling breathbar HUD flag and immortal, and the statbar disappeared as expected. However, I did notice a delay of more than a second before the statbar disappeared due to the aforementioned actions. This is probably because there's no straight way to detect whether HUD flags or armor groups change, but I just wanted to put it out here.

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.

Works on my machine.

@sfan5 sfan5 added the Rebase needed The PR needs to be rebased by its author. label Aug 12, 2019
PLAYER_MAX_BREATH_DEFAULT was earlier set to 11, so that 10 bubbles are shown before the breath bar disappears.

Now, PLAYER_MAX_BREATH_DEFAULT is set to 10, and the breath_bar scaling code in builtin has been tweaked to show all 10 bubbles before hiding the breath_bar
@ClobberXD
Copy link
Contributor Author

Rebased.

@SmallJoker SmallJoker removed the Rebase needed The PR needs to be rebased by its author. label Aug 21, 2019
@ClobberXD
Copy link
Contributor Author

Bumpity-bump

@ClobberXD
Copy link
Contributor Author

Bump

Added testing instructions to the first post.

@ClobberXD
Copy link
Contributor Author

@SmallJoker Merge?

@paramat
Copy link
Contributor

paramat commented Jan 19, 2020

Not really trivial enough for a 1-approval merge.

@ClobberXD
Copy link
Contributor Author

Delays may cause even more delays due to the need for re-testing. Better to merge this IMHO, instead of letting it stagnate, lest we have more PRs modifying the same areas of code and breaking this PR in the process.

@sfan5 sfan5 self-requested a review April 16, 2020 10:15
Copy link
Member

@sfan5 sfan5 left a comment

Choose a reason for hiding this comment

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

Tested. Works as expected.

@ClobberXD
Copy link
Contributor Author

Thanks for the review!

@SmallJoker SmallJoker merged commit a36c9c3 into minetest:master Apr 28, 2020
@ClobberXD ClobberXD deleted the statbars_fix branch April 29, 2020 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breath statbar might show 10.5 bubbles for high breath values
5 participants