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:
megaproxy 2026-05-16 18:45:11 +01:00
parent 57e1f0f389
commit 6789ca739f
5 changed files with 77 additions and 5 deletions

View file

@ -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