Stateless-by-convention recipe transaction service over Item Vault inventories. A craft is one atomic path: validate recipe and quantity, resolve exact inputs/outputs, verify item identities, preflight input availability and output capacity after planned consumption, then consume, insert, and commit in one InventoryTransaction, returning a typed CraftingResult. On any failure nothing is partially consumed or inserted, nothing is duplicated, and authoritative inventory state is unchanged. can_craft() is pure/read-only: no metrics, logs, or inventory mutations. Logging routes through ItemVaultLogger; install a CraftingLog sink via set_log_sink(). Counter metrics are always tracked on metrics.
Source: addons/item_vault/crafting/services/crafting_service.gd
Syntax
class CraftingService extends RefCountedMembers
| Name | Kind | Summary |
|---|---|---|
operation_counter | Property | Monotonic craft counter, persisted via CraftingSave so identity continues across sessions. |
metrics | Property | |
MAX_TRACKED_REQUESTS | Field | |
set_log_sink | Method | |
clear_log_sink | Method | |
set_metrics | Method | |
reset_metrics | Method | |
set_operation_counter | Method | |
clear_request_tracking | Method | |
can_craft | Method | |
craft | Method | |
craft_request | Method | |
required | Property | |
produced | Property | |
required_total | Property | |
item_def | Property | |
available | Property | |
want | Property |