Skip to content

PoolBarUI ​

Inherits: MarginContainer

UI component for displaying a single pool (health or resource)

Variables ​

SettingsConfig.HealthDisplayOptiontext_display_modeSettingsConfig.HealthDisplayOption.CURRENT_PERCENTAGE
boolshow_pool_idfalse
boolshow_pool_valuetrue
boolshow_overfilltrue
boolanimate_changestrue
floatanimation_duration0.3
PoolInstancepool_instance
intpool_id0
Tweencurrent_tween

Methods ​

voidsetup_pool_bar( p_pool_instance: PoolInstance )
Stringformat_number_with_commas( value: float )
Stringformat_number_abbreviated( value: float )
Stringformat_pool_value( value: float )
voidset_text_display_mode( mode: SettingsConfig.HealthDisplayOption )
voidset_show_pool_value( show_value: bool )
voidset_bar_modulate( color: Color )
voidset_animation_settings( enabled: bool, duration: float = 0.3 )
Dictionaryget_pool_info()
voidcleanup()

Variable descriptions ​

SettingsConfig.HealthDisplayOption text_display_mode = SettingsConfig.HealthDisplayOption.CURRENT_PERCENTAGE ​

Configuration

bool show_pool_id = false ​

True shows the id of the pool.

bool show_pool_value = true ​

True shows the numbers of the pool.

bool show_overfill = true ​

True shows the overfill.

bool animate_changes = true ​

True animates the bar when the value changes.

float animation_duration = 0.3 ​

How many seconds the animation takes.

PoolInstance pool_instance ​

Pool data

int pool_id = 0 ​

The pool the bar shows.

Tween current_tween ​

Animation

Method descriptions ​

void setup_pool_bar( p_pool_instance: PoolInstance ) ​

Initialize the pool bar with a PoolInstance

String format_number_with_commas( value: float ) ​

Format a number with commas for thousands separators

String format_number_abbreviated( value: float ) ​

Format a number with abbreviations (K, M, B)

String format_pool_value( value: float ) ​

Main formatting function - switches between comma and abbreviated based on size

void set_text_display_mode( mode: SettingsConfig.HealthDisplayOption ) ​

Set text display mode

void set_show_pool_value( show_value: bool ) ​

Set whether to show pool value

void set_bar_modulate( color: Color ) ​

Set the modulate color of the progress bar (simpler than style overrides)

void set_animation_settings( enabled: bool, duration: float = 0.3 ) ​

Set animation settings

Dictionary get_pool_info() ​

Get pool information for external use

void cleanup() ​

Cleanup when removing