Skill and item hotbar
RPGJS provides a persistent, server-authoritative ten-slot hotbar for learned skills, usable regular items, and plugin-provided entry types. Slot contents are synchronized to clients and included in player snapshots. The server remains responsible for validating ownership, consuming SP or items, and applying gameplay effects in standalone and MMORPG modes.Display and hide the built-in hotbar
Open the prebuilt CanvasEngine GUI from a server player hook:showHotbar() initializes from the current loadout by default. Pass
autoInitialize: false when the game needs to seed it later.
Hiding the GUI does not clear persistent assignments:
1 through 0. Holding the left gamepad
bumper opens the radial selector; choose with the left stick and release the
bumper to use the slot.
Games can replace these client bindings through their normal RPGJS control
configuration. Bind the actions hotbar1, hotbar2, …, hotbar0; slot state
never stores a physical keyboard or gamepad key.
Start with items, skills, or both
Pass an ordered list to initialize a specific loadout:initializeHotbar()
again preserves player choices, so use assignment methods for later changes:
Assign from the main menu
The built-in main menu supplies Items and Skills lists. Selecting an eligible entry exposes Assign to hotbar, followed by the slot picker:allowedEntryTypes.
Configure capacity
The persistent state always retains ten slots, whilecapacity controls how
many are currently accessible:
player.refreshHotbar() after game-specific state changes that can affect a
custom capacity resolver.
Restrict a hotbar to items, skills, or another registered entry type with
allowedEntryTypes:
autoOpen, the module re-evaluates enabled on map changes and closes an
open hotbar when the resolver returns false.
Theme the native component
The built-in component uses CSS custom properties with defaults. Set them from a client stylesheet; replacing the component is not required:Theme variables
The semantic
@rpgjs/ui-css hotbar primitives remain available through the
--rpg-ui-hotbar-* variables. Component-specific --rpg-hotbar-* values take
precedence when both are provided.
Replace the visual component
For a different layout or markup, register another GUI using the same prebuilt id. The server APIs and persistent state remain unchanged:PrebuiltGui.Hotbar wins. See
Prebuilt GUI Contracts for the complete data
and interaction contract.
Use and observe slots
Standard entries can be used directly on the authoritative server:player.getHotbar() and route the
selected entry through their own authoritative action. @rpgjs/action-battle
does this automatically, including cooldowns, projectiles, and targeting.
Modules can observe every state transition:
change.action is initialize, assign, clear, select, or refresh.
change.state is a detached snapshot safe to inspect or send to another
service.