aboutsummaryrefslogtreecommitdiff
path: root/building_guide
diff options
context:
space:
mode:
Diffstat (limited to 'building_guide')
-rw-r--r--building_guide/items.md2
-rw-r--r--building_guide/recipes.md65
2 files changed, 33 insertions, 34 deletions
diff --git a/building_guide/items.md b/building_guide/items.md
index 8f8d87d..eefdf9c 100644
--- a/building_guide/items.md
+++ b/building_guide/items.md
@@ -3,7 +3,7 @@
**The filename is the ID.** An item is looked up by its filename stem
(`bronze_pickaxe.yaml` → `bronze_pickaxe`); the loader derives `ItemDef.ID` from it. Do not
put an `id:` field in the file — it is ignored. Anything that references this item (drop
-tables, craft `consume`, room `item_spawns`) uses that filename.
+tables, craft `ingredients`, room `item_spawns`) uses that filename.
```yaml
name: bronze pickaxe
diff --git a/building_guide/recipes.md b/building_guide/recipes.md
index 364d375..e865fa6 100644
--- a/building_guide/recipes.md
+++ b/building_guide/recipes.md
@@ -2,20 +2,20 @@
## Crafting
-Crafting information lives on the **output item's YAML file** via the `craft:` block. There is no separate recipe directory. To find out how to make `bronze_dagger`, open `data/items/equipment/bronze_dagger.yaml` and look for the `craft:` block. (The item's **filename is its ID** — `bronze_dagger.yaml` → `bronze_dagger`; there is no `id:` field. `consume`/output entries reference items by filename.)
+Crafting information lives on the **output item's YAML file** via the `craft:` block. There is no separate recipe directory. To find out how to make `bronze_dagger`, open `data/items/equipment/bronze_dagger.yaml` and look for the `craft:` block. (The item's **filename is its ID** — `bronze_dagger.yaml` → `bronze_dagger`; there is no `id:` field. `ingredients`/output entries reference items by filename.)
### Craft YAML Reference
| Field | Type | Description |
| -------------- | -------------- | ----------------------------------------------- |
-| `type` | string | Craft type (pharmacy, smithing, cooking, smelting, crafting, fletching, construction, clean, or "" for skill-less) |
-| `skill` | string | Skill checked (defaults to type if omitted) |
+| `type` | string | Craft type (smithing, cooking, crafting, fletching, pharmacy, construction, combine, or "" for skill-less). Always matches a player skill name. |
+| `subtype` | string | Production method override (`smelt` for furnace recipes, `clean` for herb cleaning). Defaults empty (no override). |
| `level` | int | Required skill level |
| `xp` | int | XP awarded on success |
| `wait` | float64 | Ticks per craft cycle |
| `station` | []string | Station object IDs required (optional) |
| `tool` | string | Required tool_type (optional) |
-| `consume` | []ConsumeEntry | Ingredients consumed (see below) |
+| `ingredients` | []IngredientEntry | Ingredients consumed (see below) |
| `output_qty` | int | Quantity produced (default 1, for stackables) |
| `fail` | string | ItemID produced on failure (optional) |
| `message` | string | Success message per cycle (optional, see message defaults) |
@@ -34,12 +34,12 @@ All message fields (`message`, `fail_message`, `start_message`, `end_message`, a
| Variable | Expands to |
| -------- | ----------------------------------------------- |
| `%n` | Output item name (colored, e.g. "stim potion") |
-| `%i1` | 1st consume entry's matched item (colored) |
-| `%i2` | 2nd consume entry's matched item (colored) |
+| `%i1` | 1st ingredient entry's matched item (colored) |
+| `%i2` | 2nd ingredient entry's matched item (colored) |
| `%b1` | 1st byproduct item name (colored, success only) |
| `%b2` | 2nd byproduct item name (colored, success only) |
-Numbering follows YAML consume/byproduct order. If a consume entry has multiple alternative items (`items: [a, b]`), the variable expands to whichever the player actually possesses, colored with that item's `color:` field.
+Numbering follows YAML ingredient/byproduct order. If an ingredient entry has multiple alternative items (`items: [a, b]`), the variable expands to whichever the player actually possesses, colored with that item's `color:` field.
Variables work alongside inline color tags (`{C4}text{/}`) which are expanded after variable substitution.
@@ -50,7 +50,7 @@ If a message field is omitted from the YAML, the game uses a skill-level default
| Type | Default `message` | Default `start_message` |
|------|-------------------|------------------------|
| `cooking` | `"Cooked to perfection. %n looks great!"` | `"You start cooking %i1."` |
-| `smelting` | `"You remove a white hot %n!"` | `"You place the %i1 into the furnace."` |
+| `smelt` | `"You remove a white hot %n!"` | `"You place the %i1 into the furnace."` |
| `smithing` | `"You smith a %n."` | `"You begin smithing %i1."` |
| `crafting` | `"You craft a %n."` | `"You begin crafting %i1."` |
| `fletching` | `"You fletch a %n."` | `"You begin fletching %i1."` |
@@ -59,7 +59,7 @@ If a message field is omitted from the YAML, the game uses a skill-level default
| `clean` | `"You clean the %i1."` | `"You begin cleaning herbs."` |
| (unset) | `"You produce %n."` | `"You start <verb> %i1."` |
-Any of these can be overridden per-item by setting the field in YAML. For skills that never fail (smithing, crafting, fletching, pharmacy, construction), `fail_message` defaults to empty — no message is shown on failure.
+Default messages are keyed by `subtype` when set, otherwise by `type`. For skills that never fail (smithing, crafting, fletching, pharmacy, construction), `fail_message` defaults to empty — no message is shown on failure.
### CraftStep — Multi-Step Messages
@@ -69,7 +69,7 @@ Optional interim messages fired at specific tick offsets during the craft cycle.
craft:
type: ""
wait: 6
- consume:
+ ingredients:
- items: [map_piece_1]
quantity: 1
- items: [map_piece_2]
@@ -84,12 +84,12 @@ craft:
message: "You assemble the map!"
```
-### ConsumeEntry — Multi-Item Ingredient Slots
+### IngredientEntry — Multi-Item Ingredient Slots
-Each consume entry defines an ingredient slot with multiple valid items. The first matching item found in the player's inventory is consumed.
+Each ingredient entry defines an ingredient slot with multiple valid items. The first matching item found in the player's inventory is consumed.
```yaml
-consume:
+ingredients:
- items: [item_id, alternative_id, ...]
quantity: 1
byproducts: [byproduct_for_item, byproduct_for_alt, ...]
@@ -98,7 +98,7 @@ consume:
`byproducts` is optional. When present, it matches the `items` list by index — consuming `items[0]` returns `byproducts[0]` to inventory. Use `""` for items with no byproduct:
```yaml
-consume:
+ingredients:
- items: [bucket_of_water, vial_of_water]
quantity: 1
byproducts: [empty_bucket, ""] # bucket returns empty, vial is consumed entirely
@@ -112,11 +112,10 @@ consume:
# data/items/consumables/stim_potion.yaml
craft:
type: pharmacy
- skill: pharmacy
level: 3
xp: 25
wait: 4
- consume:
+ ingredients:
- items: [guam_potion_unf]
quantity: 1
- items: [eye_of_newt]
@@ -129,13 +128,13 @@ craft:
```yaml
# data/items/materials/bronze_bar.yaml
craft:
- type: smelting
- skill: smithing
+ type: smithing
+ subtype: smelt
level: 1
xp: 6
wait: 4
station: [furnace]
- consume:
+ ingredients:
- items: [copper_ore]
quantity: 1
- items: [tin_ore]
@@ -148,12 +147,11 @@ craft:
# data/items/equipment/bronze_dagger.yaml
craft:
type: smithing
- skill: smithing
level: 1
xp: 12
wait: 4
station: [anvil]
- consume:
+ ingredients:
- items: [bronze_bar]
quantity: 1
# message omitted — uses default "You smith a %n."
@@ -165,12 +163,11 @@ For stackable outputs, use `output_qty`:
# data/items/ammo/bronze_nails.yaml
craft:
type: smithing
- skill: smithing
level: 4
xp: 12
wait: 4
station: [anvil]
- consume:
+ ingredients:
- items: [bronze_bar]
quantity: 1
output_qty: 15
@@ -187,7 +184,7 @@ craft:
xp: 5
wait: 3
tool: knife
- consume:
+ ingredients:
- items: [logs, oak_logs, willow_logs]
quantity: 1
output_qty: 15
@@ -203,7 +200,7 @@ Omit `type` (or leave it empty) for combinations with no skill check, no XP, and
# data/items/consumables/bucket_of_water.yaml
craft:
wait: 0
- consume:
+ ingredients:
- items: [vial_of_water, jug_of_water]
quantity: 1
byproducts: [empty_vial, empty_jug]
@@ -218,7 +215,7 @@ craft:
# data/items/quest/ancient_map.yaml
craft:
wait: 0
- consume:
+ ingredients:
- items: [torn_page_1]
quantity: 1
- items: [torn_page_2]
@@ -235,17 +232,17 @@ craft:
### Clean Recipes
-Clean herb recipes use `type: clean` and are handled as background actions (one herb per cycle, directly mutating inventory):
+Clean herb recipes use `type: pharmacy` with `subtype: clean` and are handled as background actions (one herb per cycle, directly mutating inventory):
```yaml
# data/items/materials/guam.yaml (clean guam)
craft:
- type: clean
- skill: pharmacy
+ type: pharmacy
+ subtype: clean
level: 3
xp: 3
wait: 2
- consume:
+ ingredients:
- items: [grimy_guam]
quantity: 1
# message omitted — uses default "You clean the %i1."
@@ -267,10 +264,12 @@ eat_message: "You eat the bread. Warm and satisfying."
### Architecture
-The `CraftIndex` (`internal/game/craft_index.go`) is built once at startup from all item YAMLs that have a `craft:` block. It provides `O(1)` lookups by type, input item, and station. All crafting commands query the CraftIndex — no runtime file scanning.
+The `CraftIndex` (`internal/game/production_index.go`) is built once at startup from all item YAMLs that have a `craft:` block. It provides `O(1)` lookups by type, subtype, input item, and station. All crafting commands query the CraftIndex — no runtime file scanning.
**Indexes:**
- `byType["pharmacy"]` → all pharmacy-craftable items (used by `mix`)
-- `byInput["guam"]` → all items that consume guam (used by `use` to find combinations)
+- `bySubtype["clean"]` → all items with subtype `clean` (grimy herb cleaning)
+- `bySubtype["smelt"]` → all items with subtype `smelt` (furnace smelting)
+- `byInput["guam"]` → all items that use guam (used by `use` to find combinations)
- `byStation["anvil"]` → all items craftable at an anvil (used by `use bar on anvil`)
-- `FindByTwoInputs(a, b)` → items consuming both inputs in different consume entries
+- `FindByTwoInputs(a, b)` → items consuming both inputs in different ingredient entries