Skip to content

03 — Validators and Modifiers

Goal:
Understand how to influence crafting behaviour using validators and modifiers in a controlled sample scene.


🎓 What This Scene Demonstrates

This scene explores how the Crafting system can be extended and influenced using validators and modifiers.

You’ll see how to:

  • Use ICraftingValidator to influence whether a craft is allowed, for example:
  • Cooldowns, level gates, or conditional restrictions
  • Context-sensitive rules such as station or owner requirements
  • Use ICraftingModifier to influence how a craft behaves, such as:
  • Adjusting duration, currency cost, or output amounts
  • Applying bonuses or penalties based on game state
  • Observe how validators and modifiers are discovered automatically via the owner hierarchy
  • Toggle validators and modifiers live during Play Mode to observe their effect on preflight
  • Combine multiple rules and effects to create more complex crafting behaviour

This scene demonstrates behaviour and diagnostics — it does not define guaranteed execution order or lifecycle timing for validators or modifiers.


Scope Reminder
RevFramework does not implement networking, replication, prediction, rollback, or reconciliation.
These samples demonstrate authority-gating patterns only — all networking behaviour is your responsibility.


⚠️ Authority Note

No Authority Binder is assigned in this scene.

Leaving the Authority Binder field on CraftingServiceCore unassigned allows crafting to be tested locally without authority checks.

To enforce authority, you must assign an Authority Binder to the service.
Adding the component alone does not automatically block crafting.


🧩 How to Use

  1. Enter Play Mode and open the Validators & Modifiers panel.
  2. Review which validators and modifiers are currently attached to the character or parent objects.
  3. Toggle components on/off to see how preflight results change in real time.
  4. Adjust the Craft Count, then test CanCraft?, Craft 1, or Craft Max.
  5. Observe how enabling or disabling rules affects the reported Max Crafts and Reason values.

Some sample validators may expose demo-only helpers for testing (e.g., cooldown seeding). These helpers are not production patterns.


⚙️ Behind the Scenes

  • Uses FakeInventoryAdapter and FakeCurrencyAdapter for a self-contained setup.
  • Calls real service APIs such as CraftingServiceCore.CanCraftDetailed() and Enqueue().
  • Validators and modifiers are discovered via the owner → parents hierarchy.
  • Validators may influence preflight outcomes and reported failure reasons.
  • Modifiers may influence preflight values and/or final applied results depending on configuration.

💡 Key Takeaway

  • Validators influence whether a craft can proceed.
  • Modifiers influence how a craft behaves once requested.
  • Both systems are modular and composable, allowing flexible rule sets.
  • Together they provide the extensibility needed for cooldowns, perks, restrictions, and bonuses.

Panel: CraftingValidatorsModifiersPanel
Scene Path:
Assets/RevFramework/Samples/Crafting/Scenes/03_Validators_And_Modifiers/