Skip to content

Hotbar

ModularHotbar provides a quick-access horizontal bar for items, typically displayed at the bottom center of the screen. It displays a specific "window" of the player's main inventory.

Setup

  1. Add a ModularHotbar node to your UI.
  2. Assign an HBoxContainer to the slots_container property.
  3. Link it to an InventoryComponent via the source_component property.
  4. Configure the window:
  5. hotbar_size: How many slots to display (e.g., 9).
  6. start_index: starting index in the main inventory (e.g., 0 for slots 0-8).

Scroll Navigation

Players can cycle through hotbar slots using the mouse wheel. - enable_scroll_navigation: Toggles mouse wheel support. - scroll_wraps: If true, scrolling past the last slot loops back to the first. If false, it stops at the ends. - Visual Feedback: When scrolling, the newly selected slot briefly flashes (modulate tween) to provide clear visual feedback.

Signals

hotbar emits signals so your player controller or animation system can react to slot changes:

Signal Description
selection_changed(new_index: int) Emitted when the player scrolls or clicks a new slot. Use this to update your 3D player model's equipped weapon or change the crosshair.

quick_used Signal Removed

quick_used signal has been removed in this version. Right-clicking a hotbar slot now triggers a quick-move operation (transferring a single item to another open inventory) instead of emitting a signal.

If you need custom right-click behavior, you must implement it in your own hotbar subclass.

Input Handling

  • Left Click: Selects the slot.
  • Right Click: Transfers a single item to another open inventory (if one is visible).
  • Scroll Wheel: Changes the selected_index and emits selection_changed.