Skip to content

🧩 Crafting — Core / Context

📦 Folder Overview

This folder defines the data context passed through the crafting pipeline.

Types in this folder describe what a craft is and how it may be adjusted, without defining when or why those adjustments are applied.

These types are intentionally small, explicit, and side-effect free.


🧩 What Lives Here

CraftContext

An immutable value describing the context for a single craft evaluation.

Includes:

  • owning GameObject
  • RecipeCore being crafted
  • resolved default container name
  • station or bench tag (if any)

Used by:

  • modifiers (ICraftingModifier)
  • validators (ICraftingValidator)
  • output routing logic

CraftContext is read-only and must not be mutated.


CraftAdjustments

A mutable bundle used to modify craft behaviour.

Allows adjustment of:

  • duration (durationSeconds)
  • currency cost (currencyMultiplier)
  • output count (outputMultiplier)
  • extra guaranteed outputs
  • chance-based outputs

The Crafting service:

  • initializes default values
  • invokes modifiers in a defined order
  • clamps final values before use

Adjustments may be recomputed at delivery time.


🎯 Purpose

These types provide a consistent data surface for:

  • evaluating crafting behaviour
  • applying modifiers and validation rules
  • passing context through the crafting pipeline

They separate data representation from execution logic.


🧠 Usage Guidance

Modifiers

  • read from CraftContext
  • mutate CraftAdjustments

Do not:

  • access inventory or currency directly
  • assume a specific execution timing
  • cache context references

Modifiers may be evaluated multiple times and should be side-effect free.


Validators

  • inspect CraftContext
  • inspect proposed CraftCheck
  • return a modified result

Validators do not execute crafting behaviour and should not mutate external state.


⚠️ Important Notes

  • This folder contains data types only
  • No business logic or execution rules belong here
  • Behaviour is defined by the Crafting service and integrations

🚫 Not for Production Use

This folder does not include:

  • inventory or currency access
  • scheduling or timing logic
  • persistence logic

  • Crafting Core (execution and orchestration)
  • Crafting Extensibility (modifiers and validators)

🧱 Public API

All types in this folder are part of the supported Crafting API surface.

They are intended for use by:

  • gameplay code
  • UI layers
  • teaching tools
  • external extensions

🧠 Design Notes

  • small, explicit data types
  • controlled mutability (CraftAdjustments only)
  • no coupling to adapters or systems

If additional data is required, it should be provided by external systems rather than extending this context.