ActionBarButton ​
Inherits: MarginContainer
Modern action bar button that handles both abilities and items
Properties ​
String | slot_number |
Variables ​
Player | owner_player | |
ActionBarSlotData | slot_data | |
Timer | ability_cooldown_timer | |
Timer | global_cooldown_timer | |
String | slot_keybind | |
bool | alert_effect_active | false: |
bool | bar_locked | false |
bool | showing_charge_cooldown | false |
bool | is_showing_cooldown | false |
Timer | long_press_timer | |
bool | is_mouse_held | false |
float | press_start_time | 0.0 |
float | long_press_duration | 0.2 |
SettingsManager | settings_manager | |
PlayerController | player_controller | |
bool | rearrange_allowed | true |
Methods ​
void | initialize_ui( p_system_hub: GameHost.SystemHub ) |
void | set_player_owner( player: Player ) |
void | set_slot_data( new_slot_data: ActionBarSlotData ) |
bool | can_be_changed() |
void | set_ability( ability: AbilityInstance ) |
void | set_item( item: ItemInstance, quantity: int = 1 ) |
void | clear() |
Variant | get_current_content() |
bool | is_empty() |
void | use_content() |
void | right_click_use_content() |
void | set_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.