rimlike/scenes/ai/recipe_catalog.gd
megaproxy d98d2c2425 Renewable resources: tree growth + WildGrowth + Quarry on BigRockNode
Trees: 4 growth stages (Sapling→Young→Growing→Mature), only Mature
yields wood. WildGrowth ticker fires every in-game hour; rejection-
samples grass tiles and plants a sapling with ~30% probability (capped
at MAP_TREE_LIMIT=60). New `paint_plant_tree` designation lets the
player manually plant — ghost sapling registered as a build_site that
ConstructionProvider fulfils. Stage round-trips through save/load.
Initial seed mixes 4 saplings + 6 mature so growth is visible day 1.

Quarry: new BigRockNode entity (2×2 permanent stone outcrop, never
depletes). 3 nodes seeded far from cabin. New QuarryWorkbench
(extends Workbench, auto-FOREVER `quarry_stone` bill, recipe drops
1 stone per 300 work-ticks). New `paint_quarry` designation only
accepts BigRockNode tiles. CraftingProvider now supports recipes
with `ingredient_count == 0` — skips ingredient-fetch and goes
straight to walk+craft toils. Recipe gains `ingredient_count` field
(defaults 0). Save/load layering: big_rock_node spawns at priority 0
(same as rock/tree), quarry_workbench at priority 2 (after the node).

UI: Plant tree + Build quarry buttons added to Build drawer.
build_drawer_thumb gains `plant_tree` (sapling sprout in dirt) and
`paint_quarry` (stone block + chisel + cut-stone pile) shapes.
inspect_tooltip recognises BigRockNode + shows tree growth stage on
hover.

Delegation: gdscript-refactor (Sonnet ×2) for trees full impl +
quarry skeleton; quick-edit (Haiku) for CraftingProvider no-ingredient
plumbing + TopBar polish; integration handled on Opus.
2026-05-16 16:36:16 +01:00

141 lines
5 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class_name RecipeCatalog
## Static registry of all recipes. Each method returns a fresh Recipe instance
## configured for that product. Extend here as new workbenches land.
##
## Phase 6 — two recipes:
## plank() — wood → plank (Carpenter's bench, Crafting)
## stone_block() — stone → stone_block (Smelter, Crafting)
##
## Phase 7 — cooking chain (grain → flour → bread, vegetable → meal):
## flour() — grain → flour (Millstone, Crafting)
## bread() — flour → bread (Hearth, Cooking)
## meal_from_vegetables() — vegetable → meal (Hearth, Cooking)
##
## The full ~22-recipe list per docs/design.md continues in Phase 8+.
static func plank() -> Recipe:
var r := Recipe.new()
r.id = &"plank"
r.label = "Wood plank"
r.ingredient_type = Item.TYPE_WOOD
r.output_type = Item.TYPE_PLANK
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
return r
static func stone_block() -> Recipe:
var r := Recipe.new()
r.id = &"stone_block"
r.label = "Stone block"
r.ingredient_type = Item.TYPE_STONE
r.output_type = Item.TYPE_STONE_BLOCK
r.work_ticks = 80 # ~4 sim seconds at 1×
r.required_skill = Recipe.SKILL_CRAFTING
r.skill_threshold = 0
return r
# ── Phase 7 — cooking chain ───────────────────────────────────────────────────
static func flour() -> Recipe:
## Step 1 of the grain→flour→bread chain.
## Ingredient: grain. Output: flour. Worked at the Millstone (accepted_skill = crafting).
## Any crafter can do this — no culinary expertise required for grinding.
var r := Recipe.new()
r.id = &"flour"
r.label = "Flour"
r.ingredient_type = Item.TYPE_GRAIN
r.output_type = Item.TYPE_FLOUR
r.work_ticks = 50 # ~2.5 sim seconds at 1× — quick grinding pass
r.required_skill = Recipe.SKILL_CRAFTING
r.skill_threshold = 0
return r
static func bread() -> Recipe:
## Step 2 of the grain→flour→bread chain.
## Ingredient: flour. Output: bread. Worked at the Hearth (accepted_skill = cooking).
var r := Recipe.new()
r.id = &"bread"
r.label = "Bread"
r.ingredient_type = Item.TYPE_FLOUR
r.output_type = Item.TYPE_BREAD
r.work_ticks = 90 # ~4.5 sim seconds at 1× — baking takes longer
r.required_skill = Recipe.SKILL_COOKING
r.skill_threshold = 0
return r
static func meal_from_vegetables() -> Recipe:
## Single-step cooking: vegetable → meal. Worked at the Hearth (accepted_skill = cooking).
## Parallel path so harvested produce (potatoes, etc.) can reach the belly
## without going through the grain chain.
var r := Recipe.new()
r.id = &"meal_veg"
r.label = "Veggie meal"
r.ingredient_type = Item.TYPE_VEGETABLE
r.output_type = Item.TYPE_MEAL
r.work_ticks = 80 # ~4 sim seconds at 1×
r.required_skill = Recipe.SKILL_COOKING
r.skill_threshold = 0
return r
# ── Phase 14 — Death + cremation ─────────────────────────────────────────────
static func cremate_corpse() -> Recipe:
## Cremation recipe. Primary ingredient: 1 corpse (TYPE_CORPSE).
## Secondary ingredient: 5 wood (ingredient2_type / ingredient2_count) — see
## recipe.gd for the Phase 14 extension fields.
## Output: 1 ash item (TYPE_ASH). Work time: 60 ticks (~3 sim seconds at 1×).
## No Quality roll — cremation is binary. accepted_skill = manual_labor;
## any laborer can operate the pyre.
##
## Stub gap: CraftingProvider's ingredient-pickup step only handles the
## primary ingredient (ingredient_type = TYPE_CORPSE). The 5-wood secondary
## requirement is recorded in ingredient2_type/ingredient2_count but is NOT
## enforced at runtime until CraftingProvider is extended (Phase 14 follow-up).
var r := Recipe.new()
r.id = &"cremate_corpse"
r.label = "Cremate corpse"
r.ingredient_type = Item.TYPE_CORPSE
r.ingredient2_type = Item.TYPE_WOOD
r.ingredient2_count = 5
r.output_type = Item.TYPE_ASH
r.work_ticks = 60 # ~3 sim seconds at 1×
r.required_skill = &"manual_labor"
r.skill_threshold = 0
return r
## Quarry workbench — no input, produces 1 stone per work cycle. Used by the
## QuarryWorkbench placed on a BigRockNode for renewable stone supply.
static func quarry_stone() -> Recipe:
var r := Recipe.new()
r.id = &"quarry_stone"
r.label = "Quarry stone"
r.ingredient_type = &"" # no input
r.ingredient_count = 0
r.output_type = Item.TYPE_STONE
r.work_ticks = 300
r.required_skill = &"manual_labor"
r.skill_threshold = 0
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`.
static func all() -> Array[Recipe]:
return [
plank(),
stone_block(),
flour(),
bread(),
meal_from_vegetables(),
cremate_corpse(),
quarry_stone(),
]