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.
Add "off state" textures to the builtin statbars.
Co-authored-by: SmallJoker <mk939@ymail.com>
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
Document new meaning of immortal=1 for players
Disable breathing if player is immortal
Hide builtin statbars if player immortal (delayed)
Co-authored-by: ClobberXD <ClobberXD@gmail.com>
Centralize HUD updating in update_builtin_statbars.
Fixes race condition in 'on joinplayer' that causes stat bar bugs.
Correctly scales stat bars to custom max values set by mods.
* Respect object property hp_max field for players
This allows modders to configure the maximal HP per player
* Statbars: Downscale bar to full 20 HP when exceeding this value
Add default max HP for players and breath constants to builtin
Document the constants
* Rename PLAYER_MAX_HP -> PLAYER_MAX_HP_DEFAULT
This unifies the settings APIs.
This also unifies the sync and async registration APIs, since the async
registration API did not support adding non-functions to the API table.