add iron/gold smelting + disambiguate workbench-vs-recipe
Q: iron_smelt (iron_ore + wood → iron_ingot) and gold_smelt (gold + wood → gold_ingot) recipes added at Smelter, using the existing ingredient2 buffer mechanism. New TYPE_IRON_INGOT and TYPE_GOLD_INGOT item types (procedural hue-hash draw for now). R: new Recipe.target_workbench field (StringName, empty = any matching skill) round-trips through to_dict/from_dict. Workbench bill picker filters by both required_skill AND target_workbench vs lower-cased label_text. plank → carpenter, stone_block/iron_smelt/gold_smelt → smelter, flour → millstone. Cooking-only recipes (bread, meal) stay unrestricted since Hearth is the only cooking workbench. 9 recipes total now, 4 distinct workbench routes. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
57e1f0f389
commit
6789ca739f
5 changed files with 77 additions and 5 deletions
|
|
@ -46,6 +46,13 @@ var skill_threshold: int = 0
|
|||
## call Strings.t("item." + id) for player-visible text.
|
||||
var label: String = ""
|
||||
|
||||
## Optional workbench affinity. When non-empty, the bill picker only shows this
|
||||
## recipe at workbenches whose label_text.to_lower() matches this value.
|
||||
## Empty string (default) means "any workbench whose accepted_skill matches" —
|
||||
## i.e. the pre-Phase-19 behaviour and the correct fallback for older saves.
|
||||
## Values should be lowercase: &"carpenter", &"smelter", &"millstone".
|
||||
var target_workbench: StringName = &""
|
||||
|
||||
|
||||
# ── save / load ───────────────────────────────────────────────────────────────
|
||||
|
||||
|
|
@ -70,6 +77,7 @@ func to_dict() -> Dictionary:
|
|||
"required_skill": String(required_skill),
|
||||
"skill_threshold": skill_threshold,
|
||||
"label": label,
|
||||
"target_workbench": String(target_workbench),
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -85,4 +93,7 @@ static func from_dict(d: Dictionary) -> Recipe:
|
|||
r.required_skill = StringName(d.get("required_skill", str(SKILL_CRAFTING)))
|
||||
r.skill_threshold = int(d.get("skill_threshold", 0))
|
||||
r.label = str(d.get("label", ""))
|
||||
# Default to empty — old saves without this key get the pre-Phase-19
|
||||
# "any matching skill" behaviour, which is correct.
|
||||
r.target_workbench = StringName(d.get("target_workbench", ""))
|
||||
return r
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ static func plank() -> Recipe:
|
|||
r.work_ticks = 60 # ~3 sim seconds at 1× (20 Hz × 3 s = 60 ticks)
|
||||
r.required_skill = Recipe.SKILL_CRAFTING
|
||||
r.skill_threshold = 0
|
||||
r.target_workbench = &"carpenter"
|
||||
return r
|
||||
|
||||
|
||||
|
|
@ -35,6 +36,7 @@ static func stone_block() -> Recipe:
|
|||
r.work_ticks = 80 # ~4 sim seconds at 1×
|
||||
r.required_skill = Recipe.SKILL_CRAFTING
|
||||
r.skill_threshold = 0
|
||||
r.target_workbench = &"smelter"
|
||||
return r
|
||||
|
||||
|
||||
|
|
@ -52,6 +54,7 @@ static func flour() -> Recipe:
|
|||
r.work_ticks = 50 # ~2.5 sim seconds at 1× — quick grinding pass
|
||||
r.required_skill = Recipe.SKILL_CRAFTING
|
||||
r.skill_threshold = 0
|
||||
r.target_workbench = &"millstone"
|
||||
return r
|
||||
|
||||
|
||||
|
|
@ -125,9 +128,46 @@ static func quarry_stone() -> Recipe:
|
|||
return r
|
||||
|
||||
|
||||
# ── Phase 19 — iron/gold smelting ────────────────────────────────────────────
|
||||
|
||||
static func iron_smelt() -> Recipe:
|
||||
## Iron ore → iron ingot. Worked at the Smelter (accepted_skill = crafting).
|
||||
## Secondary fuel ingredient (wood) is recorded but not yet enforced at
|
||||
## runtime — CraftingProvider only checks the primary ingredient today.
|
||||
var r := Recipe.new()
|
||||
r.id = &"iron_smelt"
|
||||
r.label = "Smelt iron ingot"
|
||||
r.ingredient_type = Item.TYPE_IRON_ORE
|
||||
r.ingredient2_type = Item.TYPE_WOOD
|
||||
r.ingredient2_count = 1
|
||||
r.output_type = Item.TYPE_IRON_INGOT
|
||||
r.work_ticks = 200 # ~10 sim seconds at 1× — slower than stone-block
|
||||
r.required_skill = Recipe.SKILL_CRAFTING
|
||||
r.skill_threshold = 0
|
||||
r.target_workbench = &"smelter"
|
||||
return r
|
||||
|
||||
|
||||
static func gold_smelt() -> Recipe:
|
||||
## Gold ore → gold ingot. Same smelting chain as iron.
|
||||
var r := Recipe.new()
|
||||
r.id = &"gold_smelt"
|
||||
r.label = "Smelt gold ingot"
|
||||
r.ingredient_type = Item.TYPE_GOLD
|
||||
r.ingredient2_type = Item.TYPE_WOOD
|
||||
r.ingredient2_count = 1
|
||||
r.output_type = Item.TYPE_GOLD_INGOT
|
||||
r.work_ticks = 200 # ~10 sim seconds at 1×
|
||||
r.required_skill = Recipe.SKILL_CRAFTING
|
||||
r.skill_threshold = 0
|
||||
r.target_workbench = &"smelter"
|
||||
return r
|
||||
|
||||
|
||||
## Returns one fresh instance of every recipe in the catalog. Used by UI
|
||||
## recipe-pickers to enumerate available bills; callers filter by
|
||||
## `recipe.required_skill` against the workbench's `accepted_skill`.
|
||||
## `recipe.required_skill` and `recipe.target_workbench` against the
|
||||
## workbench's `accepted_skill` and `label_text`.
|
||||
static func all() -> Array[Recipe]:
|
||||
return [
|
||||
plank(),
|
||||
|
|
@ -137,4 +177,6 @@ static func all() -> Array[Recipe]:
|
|||
meal_from_vegetables(),
|
||||
cremate_corpse(),
|
||||
quarry_stone(),
|
||||
iron_smelt(),
|
||||
gold_smelt(),
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue