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
EquipmentFilterassets. - Accept-checks using
EquipmentSlot.CanAccept(ItemDefinition). - Equipping items from a container into matching slots.
- Unequipping items back into the inventory.
- Cooperation between
CharacterEquipmentandEquipmentContainer.
⚠️ 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¶
- Assign 2–3 ItemDefinitions (e.g. Sword, Helmet, Potion).
- Click Give to seed the Backpack.
- Click a Backpack slot to select it.
- In the Equipment list, observe which slots allow that item.
- Click Equip Selected → Slot to test validation.
- Click Unequip → Backpack to move items back.
Each slot’s filter compares the item’s category and tags against the assigned
EquipmentFilterasset.
💡 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
OnEquippedandOnUnequippedevents 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
TryAddAllResultto 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).