Skip to content

02 — Slots & Restrictions

Goal

Learn the backpack-to-equipment flow: seed an item, select it, preview slot acceptance, equip it, and unequip it back to inventory.


What This Scene Demonstrates

The core equipment flow:

Backpack item → slot filter preview → equip/unequip result → refreshed state

The backpack is read through SceneInventoryService. Equipment rows come from CharacterEquipment.layout. Filter checks are previews. Equip and unequip results are the source of truth.

This scene shows how inventory state, equipment rules, and presentation stay separate.


What To Look For

  • Seed Items uses GiveExact(...) to add items to the backpack through the inventory service
  • Backpack reads the live container through Get(...)
  • Backpack selection is UI-only and identifies the source slot for equip attempts
  • Equipment rows come from CharacterEquipment.layout
  • Allows Selected? previews whether the selected item passes the slot filter
  • Equip → Slot calls the equipment result API to equip from the selected backpack slot
  • Unequip → Backpack calls the equipment result API to return the equipped item to inventory
  • Last Result shows the structured result for equip/unequip operations

The preview explains likely acceptance before mutation, but the equip/unequip result is the final truth.


Sample Scope

This scene focuses only on:

  • Seeding backpack items
  • Selecting a backpack slot
  • Previewing slot filter acceptance
  • Equipping from backpack into an equipment slot
  • Unequipping from equipment back to backpack
  • Separating equipment rules from visual presentation

This scene does NOT cover:

  • Stack manipulation
  • Search or sorting
  • Snapshots
  • Transfer flows
  • Detailed filter authoring
  • Production equipment UI
  • Networking or replication

Those behaviours belong in dedicated teachable scenes or project-specific implementations.


Authority Note

This scene may include a permissive sample authority setup. If no authority is resolved, mutations are allowed for demonstration purposes.


Networking Reminder

No networking is included. Multiplayer authority and synchronization are the developer’s responsibility.


How To Use

  1. Assign ItemDefinitions in Quick Seed Items
  2. Press Give in Seed Items to add items to the backpack
  3. Select an item in the Backpack grid
  4. Read Allows Selected? in the Equipment section
  5. Press Equip → Slot on a compatible equipment row
  6. Check Current to confirm the equipped item
  7. Press Unequip → Backpack to return the item to inventory
  8. Check Last Result after equip or unequip

Failure Behaviour

Failures and blocked actions are surfaced through panel summaries, toast feedback, or InvOpResult.

Common patterns:

  • Give fails → item assignment, backpack setup, capacity, filters, or authority → Check the assigned ItemDefinition, backpack container, available space, filters, or authority setup

  • Equip is blocked before calling the result API → no readable backpack, no valid selection, empty selected slot, or filter mismatch → Select a non-empty backpack slot and choose a compatible equipment slot

  • Equip fails after the result API runs → selected slot, slot filter, inventory space, equipment layout, or authority issue → Read the result code/message and check the selected slot, equipment layout, backpack space, and authority setup

  • Unequip is blocked before calling the result API → selected equipment slot is already empty → Equip an item first

  • Unequip fails after the result API runs → backpack space, filters, inventory setup, or authority issue → Check backpack space, container setup, filters, and authority

If preview and result disagree, trust the result. Runtime rules are the final authority.


Behind The Scenes

This panel uses only public APIs and public data types visible from the teaching surface:

  • SceneInventoryService.GiveExact(...)
  • SceneInventoryService.Get(...)
  • CharacterEquipment.layout
  • CharacterEquipment.GetEquipped(...)
  • CharacterEquipment.TryEquipFromInventoryResult(...)
  • CharacterEquipment.TryUnequipToInventoryResult(...)
  • EquipmentFilter.Allows(...)
  • IReadOnlyInventoryContainer
  • ItemStack
  • ContainerId
  • InvOpResult

The panel does not bypass inventory or equipment ownership. The visual attacher is presentation-only and does not own equip rules.


Key Takeaway

Backpack state, equipment rules, and visuals are separate. Inventory owns inventory state. Equipment owns slot rules and equipped items. The panel forwards intent and reads the result.