03 — Validators and Modifiers¶
Goal¶
Understand how validators and modifiers influence Crafting through public extension seams.
This scene teaches the validator/modifier loop:
Discover → Toggle → Diagnose → Act
🎓 What This Scene Demonstrates¶
This scene focuses on two important Crafting extension points:
-
Validators Components that can block or reject a craft.
-
Modifiers Components that can adjust how a craft behaves.
Validators can affect whether a craft is allowed.
Modifiers can affect things like:
- craft duration
- currency cost
- output count
- bonus outputs
- chance outputs
The key lesson is:
Toggle the seam, then re-check the service result.
Do not assume the toggled component was the active limiter.
Another condition may still be blocking the craft.
🧭 What To Look For¶
The panel is organised around a simple learning path:
- Setup shows the current service, owner, recipe, container, station tag, and discovered seam counts.
- Validators shows discovered
ICraftingValidatorandICraftingModifiercomponents. - Diagnostics shows current preflight and probe results.
- Actions attempts real craft requests through
CraftingService.
This scene is about comparing before and after states.
A good test flow is:
- Inspect discovered validators and modifiers.
- Check the current diagnostics.
- Toggle one component.
- Re-check diagnostics.
- Attempt a craft.
- Compare the service result.
🧪 Sample Components¶
The scene may include sample validators and modifiers such as:
- a cooldown validator
- a level gate validator
- a station bonus modifier
- a chance output modifier
- a simple sample level provider
These are demo components used to make the extension seams visible.
For example:
- the cooldown validator can block repeated crafts
- the level gate validator can block crafting when the owner level is too low
- the station bonus modifier can adjust craft timing or outputs
- the chance output modifier can add probabilistic bonus output
The sample level provider is not a progression system.
It is just demo scaffolding so level-based validators have something to read.
⚠️ Important Mental Model¶
Validators and modifiers do different jobs.
Validators answer questions like:
Is this craft allowed right now?
Modifiers answer questions like:
How should this craft be adjusted?
A modifier may appear to do nothing if another limiter is still active.
For example:
- reducing craft time does not matter if the craft is blocked by missing items
- adding bonus output does not matter if output space is unavailable
- changing cost does not matter if a validator rejects the craft first
That is why this scene uses diagnostics and probe output.
The service result is the truth.
⚠️ Sample Scope¶
This is a demo scene, not a production setup.
It focuses on:
- validator discovery
- modifier discovery
- MonoBehaviour-based seam toggling
- preflight diagnostics
- probe limits
- enqueue behaviour
- visible rejection reasons
It does not focus on:
- output routing
- offline jobs
- persistence
- full progression systems
- production economy setup
- networking
Those are covered by later specialised scenes or by your own game-specific systems.
⚠️ Authority Note¶
This scene may include a local sample authority setup configured to allow crafting.
That means:
- crafting behaves permissively in this sample
- authority is not the focus of this scene
- this is not a multiplayer or server-authority implementation
To enforce real authority:
- provide an
ICraftingAuthorityimplementation - wire it into
CraftingService - do not rely on simply adding a component to the scene
🌐 Networking Reminder¶
RevFramework does not implement:
- networking
- replication
- prediction
- rollback
- reconciliation
These samples demonstrate local behaviour only.
All networking behaviour is your responsibility.
🧩 How To Use¶
- Enter Play Mode.
- Open or view the
CraftingValidatorsModifiersPanel. - Use the Setup tab to inspect the owner, service, recipe, container, station tag, and discovered seam counts.
- Use the Validators tab to inspect discovered validators and modifiers.
- Toggle one MonoBehaviour-based validator or modifier.
-
Use the Diagnostics tab to compare:
-
single craft result
- requested count result
- probe limits
- current rejection reason
-
Use the Actions tab to test:
-
CanCraft?
- Craft 1
- Craft N
- Craft Max
- Compare the result with the fake inventory/currency panels or gameplay output where relevant.
Only MonoBehaviour-based validators and modifiers can be toggled by this panel.
Non-MonoBehaviour implementations can still participate in Crafting, but this panel displays them as read-only.
🔎 Failure Behaviour¶
Failures are intentional teaching signals in this scene.
Common examples:
- cooldown active → craft is blocked until cooldown expires
- level too low → level gate validator blocks the craft
- missing items → service preflight fails
- missing currency → service preflight fails
- no output space → service preflight fails
- invalid owner/container/station → service cannot resolve the required context
- authority blocked → service gate rejects the craft
The important rule is:
A toggled seam is not always the active limiter.
If the result does not change after toggling a validator or modifier, check the diagnostics and probe output.
Something else may still be deciding the result.
⚙️ Behind The Scenes¶
The panel uses public APIs and public Unity component discovery only.
It uses service-facing APIs such as:
CanCraftDetailed()Probe()CanCraftCount()Enqueue()
Validators and modifiers are discovered from the owner and parent hierarchy using public Unity APIs.
The panel does not use:
- reflection
- internal fields
- hidden shortcuts
- fake success paths
This is intentional.
The panel behaves like a hostile consumer: it observes and drives Crafting from the outside.
💡 Key Takeaway¶
Validators decide whether a craft is allowed.
Modifiers adjust how a craft behaves.
Together they let you build modular Crafting rules without changing the core service.
The safe workflow is:
Toggle one seam → re-check diagnostics → trust the service result.
That is the point of this scene.
Panel: CraftingValidatorsModifiersPanel
Scene Path:
Assets/RevFramework/Samples/Systems/Crafting/Scenes/03_Validators_And_Modifiers/