Skip to content

🔗 Crafting — Integration

The Integration folder contains optional runtime hooks and helpers that let the Crafting system interoperate with other gameplay modules (progression, inventory, currency, etc.) without introducing hard dependencies into Crafting Core.

Nothing in this folder is required for Crafting to function. Everything here is opt-in, replaceable, and designed to keep Crafting.Core dependency-free.


🎯 Purpose

Integrations exist so Crafting can plug into external systems without modifying Core logic.

They ensure: - Crafting Core remains dependency-free - Integration code stays thin and explicit - Integrations can be removed or replaced without touching Core - Core types do not directly depend on inventory, currency, progression, or UI systems


🧩 Progression integration

ICraftingLevelProvider

ICraftingLevelProvider is an optional capability interface (typically used by validators) to expose a progression level (character, player, account, etc.).

Behaviour notes: - Entirely opt-in — if no provider is present, level-based validators should not block crafting. - Implementations should be deterministic, allocation-free, and non-throwing.

Samples: A simple example implementation lives in Samples/Crafting/DemoHooks (not in this folder), so runtime Core + Integration remain clean.


🔗 Adapter integration points

Although adapters live under /Adapters/, they are the primary integration seam between Crafting and external gameplay systems.

Interface Purpose
ICraftingInventoryAdapter Connects Crafting to your inventory system
ICraftingCurrencyAdapter Connects Crafting to your currency/economy backend
ICraftingOutputRouter Optionally routes outputs to specific containers

Adapters are pure contracts: - supply your own implementation, or - use built-in adapters when optional systems are present


🛡️ Bench authority helpers (optional)

LocalBenchAuthority

  • Default local (single-player) implementation of ICraftingBenchAuthority.
  • Always returns true.
  • Intended for Unity-facing bench/workbench code to decide whether enqueue should be attempted.

Notes: - This component is not used by CraftingServiceCore. - It exists purely to gate bench-side behaviour before enqueue. - Multiplayer projects should replace this with a netcode-aware implementation that only allows enqueue on the authority side.


⚙️ Script defines

Integrations may be conditionally compiled using scripting defines:

Define Enables
REV_INVENTORY_PRESENT Inventory adapter and optional recipe wrapper conversion paths
REV_CURRENCY_PRESENT Currency adapter integration

Crafting Core functions fully with no integration defines enabled; only optional helpers and adapters are excluded.


🧭 Where do Workbenches live?

Workbenches are Unity-facing orchestration/helpers, not Core logic. In the current layout, they live under:

  • Systems/Crafting/Workbenches

They are optional and can be removed without affecting CraftingServiceCore.

Recommendation: Keep Workbenches out of Integration.
Integration should remain a thin boundary layer of optional hooks/capabilities and seams, while Workbenches are their own Unity-facing feature area with UI/interaction concerns.


🧠 Integration guidelines

  • Keep integration code thin and stateless.
  • Let authoritative systems (inventory, economy, progression) own real logic.
  • Use validators, modifiers, or routers for gameplay rules — not Core edits.
  • For multiplayer:
  • keep authoritative systems server-side
  • wrap them with Crafting adapters
  • assign an ICraftingAuthority to CraftingServiceCore
  • execute crafting mutations on the server/host

These integrations allow Crafting to plug into any architecture while keeping the Core runtime clean, modular, and dependency-free.