Skip to content

02 — Slots & Restrictions

Goal:
Demonstrate how equipment slots use filters to control which items can be equipped — and how to visualise those rules in-scene.


Purpose

Show how EquipmentFilter assets enforce category/tag restrictions and how CharacterEquipment interacts with the inventory system at runtime.
This is the first scene where Equipment joins the loop — connecting item data, slot rules, and result-first operations. Equipment itself is not service-backed; authority gating applies to inventory mutations only.


🎓 What This Scene Teaches

  • Category & tag filtering via EquipmentFilter assets.
  • Accept-checks using EquipmentSlot.CanAccept(ItemDefinition).
  • Equipping items from a container into matching slots.
  • Unequipping items back into the inventory.
  • Cooperation between CharacterEquipment and EquipmentContainer.

⚠️ Authority Note
This scene runs with Inventory authority permissive by default.
Inventory mutations are allowed locally for demonstration purposes.

Authority binders may appear in demo scenes to make the authority boundary explicit, but Inventory does not fail-closed by default.

Why demo scenes sometimes include binders:
https://revandrab.github.io/RevFramework/authority/#demo-scenes--binders-why-youll-sometimes-see-them


🧩 How to Use

  1. Assign 2–3 ItemDefinitions (e.g. Sword, Helmet, Potion).
  2. Click Give to seed the Backpack.
  3. Click a Backpack slot to select it.
  4. In the Equipment list, observe which slots allow that item.
  5. Click Equip Selected → Slot to test validation.
  6. Click Unequip → Backpack to move items back.

Each slot’s filter compares the item’s category and tags against the assigned EquipmentFilter asset.


💡 Key Takeaways

  • Equipment slots are single-item and enforce filter logic live.
  • Filters can require or forbid tags and categories.
  • Equipping and unequipping use transaction-safe, result-first APIs:
  • TryEquipFromInventoryResult()
  • TryUnequipToInventoryResult()
  • These operations are intended to be invoked from authoritative gameplay code (e.g. server-side flows in multiplayer).
  • Both trigger OnEquipped and OnUnequipped events for visuals/SFX/UI hooks.
  • Clean rollback guarantees: failed operations restore previous state automatically.

🔧 Scene Setup

Component Purpose
InventorySlotsAndRestrictionsPanel Teachable overlay showing slot filtering and equip logic.
SceneInventoryService Central service managing containers and authority.
CharacterInventory Holds the “Backpack” container for item storage.
CharacterEquipment Defines slots (Weapon, Helmet, etc.) and their filters.
InventoryAuthorityBinder Optional baseline authority binder (default allow; toggle off to simulate NoAuthority).
Property Default Notes
Container "Backpack" Configurable on the panel.
Toggle Key Backquote (```) Show/hide the panel overlay.

Scene Path:
Assets/RevFramework/Runtime/Systems/Inventory/Samples/Scenes/02_Slots_And_Restrictions/


📝 Notes

  • Equipment rules are data-driven — swap filters without code changes.
  • Unequipped items use TryAddAllResult to re-enter the backpack safely.
  • The panel visualises live filter checks (allowed vs blocked).
  • Fully standalone — no Crafting, Currency, or other modules required.
  • Authority gating is supported via IInventoryAuthority.
    If no binder is present, service-level mutations default to allowed (single-player friendly).