05 — Real Adapters (Inventory + Currency)¶
Goal¶
Understand how Crafting integrates with real runtime systems through adapters.
This scene teaches the final integration loop:
Bind real adapters → Mutate real state → Diagnose service truth → Enqueue real jobs → Observe real results
What This Scene Demonstrates¶
This scene moves beyond fake-only Crafting demos.
It shows Crafting talking to real backing systems through the adapters assigned on CraftingService.
The key lesson is:
Crafting does not need to know which backend implementation is behind an adapter.
The flow stays the same:
- preflight checks live state
- enqueue consumes live inputs/currency where required
- jobs progress through
CraftingService - delivery writes results back through the configured adapter path
The difference is that the state being changed is now real runtime state, not isolated fake demo state.
Real-State Warning¶
This panel mutates real runtime inventory and currency state through the adapters currently assigned on CraftingService.
Use it in sandbox or test scenes only.
Do not treat this panel as production UI.
It is a verification surface for checking that Crafting, Inventory, and optional Currency wiring are working correctly.
What To Look For¶
The panel is organised around the real adapter integration flow:
- Setup confirms the service, owner, selected recipe, container, station tag, and detected adapters.
- Inv / Cur mutates real inventory and currency state through the configured adapters.
- Routing optionally demonstrates output routing and chance space policy.
- Diagnostics runs preflight and probe against live adapter state.
- Actions / Jobs enqueues real jobs and shows live progress/cancellation.
The important test is simple:
- Add real input items through the adapter.
- Credit currency if the current recipe requires it and a currency adapter is present.
- Run diagnostics.
- Enqueue a craft.
- Confirm the real inventory changes.
Inventory And Currency Setup¶
This scene is primarily about proving real Inventory integration.
Depending on which packages are installed and wired:
- Inventory may use a real
InventoryCraftingAdapter. - Currency may use a real currency adapter, or a sample/fake currency adapter in a Crafting-only setup.
That is intentional.
Currency lives in a separate module, so the scene should remain useful even when full Currency/Economy integration is not present.
The important rule is:
Crafting talks through adapters either way.
Whether the adapter points at a fake demo backend or a real gameplay service, CraftingService uses the same service-facing flow.
Sample Scope¶
This is a demo scene, not a full gameplay implementation.
It focuses on:
- real inventory adapter verification
- optional currency adapter verification
- live item add/remove/count/space checks
- live currency credit/balance checks
- preflight and probe against real adapter state
- real enqueue and delivery behaviour
- adapter wiring confidence
It does not focus on:
- deep Inventory system teaching
- deep Currency/Economy teaching
- production UI
- persistence
- networking
- server-backed authority
- full gameplay balance
Those are covered by their own systems, samples, or your game-specific implementation.
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 integration patterns only.
Cross-system sync, server authority, and multiplayer behaviour are your responsibility.
How To Use¶
- Enter Play Mode.
- Open or view the
CraftingRealAdaptersPanel. -
Use the Setup tab to confirm:
-
CraftingService - owner
- inventory adapter
- optional currency adapter
- selected recipe
- container and station tag
-
Use the Inv / Cur tab to test real adapter state:
-
Add item
- Remove item
- Count / Space
- Credit currency if a currency adapter is present
- Check the real Inventory panel or runtime state to confirm that item changes are reflected.
- Use the Routing tab only if you want to test demo routing or chance space policy.
-
Use the Diagnostics tab to inspect:
-
single craft result
- requested count result
- probe limits for items, currency, and space
-
Use the Actions / Jobs tab to run:
-
CanCraft?
- Craft 1
- Craft N
- Craft Max
- Observe real item consumption, output delivery, optional currency debit, and live job state.
Failure Behaviour¶
Failures are intentional teaching signals in this scene.
Common examples:
- inventory adapter missing → Crafting cannot resolve item state
- owner missing → adapter context cannot be resolved
- wrong container name → item count/space checks may fail
- missing items → preflight blocks the craft
- no output space → preflight or delivery blocks the result
- currency adapter missing → currency-gated recipes fail preflight
- insufficient currency → currency limits the craft
- live state changed after preflight → enqueue or delivery may still fail
The important rule is:
If real adapter state is wrong, service results will reflect that.
Do not bypass the service to “fix” the test.
Fix the adapter binding, owner, container, recipe, or runtime state.
Behind The Scenes¶
The panel uses the real adapters currently assigned on CraftingService.
Inventory operations go through service-facing adapter access such as:
TryGetInventoryContext(...)TryAddExact(...)TryConsumeExact(...)CountOf(...)HasSpaceExact(...)
Currency operations, when available, go through the configured currency adapter using calls such as:
Credit(...)GetBalance(...)
Crafting diagnostics and actions use public CraftingService APIs such as:
CanCraftDetailed(...)Probe(...)CanCraftCount(...)Enqueue(...)GetJobs(...)CancelJob(...)
This panel does not fake success or bypass the service.
Routing Note¶
The panel may attach or use a TeachingOutputRouter for routing demonstrations.
That router is teachables-only.
It exists so routing and chance space policy can be tested while using real Inventory/Currency adapter state.
Real inventory and currency remain real.
Service results remain the source of truth.
Key Takeaway¶
Nothing about the Crafting flow changes when you move from fake adapters to real systems.
The same model still applies:
Preflight → Enqueue → Job execution → Delivery
The difference is where the state comes from.
With real adapters, Crafting reads from and writes to real runtime systems.
That is why the adapter seam matters.
Crafting remains backend-agnostic.
Your project decides what the adapters connect to.
Panel: CraftingRealAdaptersPanel Scene Path:
Assets/RevFramework/Integrations/Crafting/InventoryIntegration/Scenes/05_Adapters_InventoryCurrency/05_Real_Adapters_With_InventoryCurrency