Skip to content

ActionBarButton ​

Inherits: MarginContainer

Modern action bar button that handles both abilities and items

Properties ​

Stringslot_number

Variables ​

Playerowner_player
ActionBarSlotDataslot_data
Timerability_cooldown_timer
Timerglobal_cooldown_timer
Stringslot_keybind
boolalert_effect_activefalse:
boolbar_lockedfalse
boolshowing_charge_cooldownfalse
boolis_showing_cooldownfalse
Timerlong_press_timer
boolis_mouse_heldfalse
floatpress_start_time0.0
floatlong_press_duration0.2
SettingsManagersettings_manager
PlayerControllerplayer_controller
boolrearrange_allowedtrue

Methods ​

voidinitialize_ui( p_system_hub: GameHost.SystemHub )
voidset_player_owner( player: Player )
voidset_slot_data( new_slot_data: ActionBarSlotData )
boolcan_be_changed()
voidset_ability( ability: AbilityInstance )
voidset_item( item: ItemInstance, quantity: int = 1 )
voidclear()
Variantget_current_content()
boolis_empty()
voiduse_content()
voidright_click_use_content()
voidset_keybind_key()

Signals ​

content_changed( slot_number: int, slot_data: ActionBarSlotData ) ​

Emitted when the slot gets another content: the slot number and its data.

ability_tooltip_requested( ability: AbilityInstance ) ​

Asks the interface to show the tooltip of an ability.

item_tooltip_requested( item: ItemInstance, definition: ItemDefinition, context: String, additional_data: Dictionary ) ​

Asks the interface to show the tooltip of an item: the item, its definition, where it is and extra data.

hide_tooltip( force_hide: bool ) ​

Asks the interface to hide the tooltip (force hides it at once).

warning_message_requested( message: String ) ​

Asks the interface to show a warning.

ability_drag_requested( ability: AbilityInstance ) ​

========== DRAG SIGNALS ==========

item_drag_requested( item: ItemInstance ) ​

Asks the interface to start dragging the item of the slot.

Property descriptions ​

String slot_number ​

The slot number for this action bar button (used for keybinding and identification)

Variable descriptions ​

Player owner_player ​

The player entity that owns this action bar

ActionBarSlotData slot_data ​

The slot data for this button

Timer ability_cooldown_timer ​

Timer for ability cooldowns

Timer global_cooldown_timer ​

Timer for the entity's global cooldown

String slot_keybind ​

The keybind string for this slot (e.g., "1", "Ctrl 2", etc.)

bool alert_effect_active = false: ​

Whether the alert effect animation is currently active

bool bar_locked = false ​

Whether the action bar is locked (prevents drag operations)

bool showing_charge_cooldown = false ​

Whether we're currently showing charge-based cooldown

bool is_showing_cooldown = false ​

Whether we're currently showing any cooldown

Timer long_press_timer ​

Timer for detecting long press gestures for drag operations

bool is_mouse_held = false ​

Whether the mouse button is currently being held down

float press_start_time = 0.0 ​

Timestamp when the mouse press started (for long press detection)

float long_press_duration = 0.2 ​

Duration required for a long press to trigger drag mode

SettingsManager settings_manager ​

SystemRefs

PlayerController player_controller ​

The controller that uses the slot.

bool rearrange_allowed = true ​

The bar this button is on lets the player rearrange it (a bar that only shows sets this off)

Method descriptions ​

void initialize_ui( p_system_hub: GameHost.SystemHub ) ​

Sets the part up with the hub of the game systems: connects the signals it listens to and fills it.

void set_player_owner( player: Player ) ​

Set the player owner for this button

void set_slot_data( new_slot_data: ActionBarSlotData ) ​

Set content using slot data

bool can_be_changed() ​

Can the player put something on this slot or take it off? (the bar allows it, and the project, the plan of the class or an effect does not lock the slot)

void set_ability( ability: AbilityInstance ) ​

Set content from ability instance

void set_item( item: ItemInstance, quantity: int = 1 ) ​

Set content from item instance - REFACTORED: now takes item instance directly

void clear() ​

Clear the slot

Variant get_current_content() ​

Get the current content (ability or item instance)

bool is_empty() ​

Check if slot is empty

void use_content() ​

Uses what the slot holds (the controller does it).

void right_click_use_content() ​

REFACTORED: Right-click now properly uses inventory system for item consumption

void set_keybind_key() ​

Shows the key that is bound to the slot.