crafting: retire form, unify on affordance capability axis (ADR-0055 amendment)
Recipe roles now match on a single `affordance.*` axis, required by both consumed `inputs` and non-consumed `tools` (the inputs/tools split carries consumption, not a separate axis). `form` — which conflated geometry, identity and capability — is removed. Its functional members folded into affordances (blade->cutting, shaft->leverage, plus knappable/spinnable/binding); identity members became template-id (chop_tree) or material+weight (log, hammer head). vagrant-skeleton v0.20.0; no crafting/composition lib bump (they never knew `form`). Verified headless via the tool-harness: 16/16 checks pass — role-flexibility (stick OR branch hafts), weight discrimination, tool-gating (tool not consumed), and anti-recursion guards (sharp_stone not re-knappable, cordage not re-spinnable).
This commit is contained in:
@@ -2,136 +2,155 @@
|
||||
-- content/stone_age.lua — T1-modder content pack: Stone-Age items + recipes.
|
||||
--
|
||||
-- PURE CONTENT via the authoring API `c` (see init.lua's content facade):
|
||||
-- c.T{ id, name, desc, weight, vol, form=, material={...}, affordance={...},
|
||||
-- c.T{ id, name, desc, weight, vol, material={...}, affordance={...},
|
||||
-- atlas="tc"|"stone", uv="<sprite-key>", scale? } -- define an item
|
||||
-- c.R{ ...crafting.define_recipe def... } -- define a recipe
|
||||
-- c.S{ template, x, y } -- place item in world
|
||||
--
|
||||
-- ROLE-BASED RECIPES (the intent): a recipe slot asks for the ROLE it needs,
|
||||
-- and ANY item that fills that role qualifies — not a specific item id. Roles
|
||||
-- are expressed as property-constraints (crafting v0.3 / ADR-0055):
|
||||
-- * `form` — physical role: shaft / cord / fiber / lump / blade / …
|
||||
-- ROLE-BASED RECIPES (the intent): a recipe slot asks for the CAPABILITY it
|
||||
-- needs, and ANY item that offers that capability qualifies — not a specific
|
||||
-- item id. Capabilities are expressed as property-constraints (crafting v0.3 /
|
||||
-- ADR-0055 + its 2026-07-31 amendment). Two orthogonal axes carry a recipe:
|
||||
-- * `affordance.*` — what an item OFFERS / can DO / what role it fills:
|
||||
-- cutting / hammering / chopping / leverage / binding /
|
||||
-- spinnable / knappable / piercing … (open vocabulary)
|
||||
-- * `composition.*`— material makeup (wood / stone / fiber …)
|
||||
-- * `weight` — size discriminator (light stick vs heavy branch)
|
||||
-- * `affordance.*` — functional capability of a TOOL (cutting/hammering/…)
|
||||
-- e.g. a "haft" = { form="shaft" } → any stick OR branch OR pole works.
|
||||
-- * `weight` — mass discriminator (light stick vs heavy branch)
|
||||
-- e.g. a "haft" = { ["affordance.leverage"]=true } → any stick OR branch OR
|
||||
-- pole works. The SAME affordance vocabulary is required by both consumed
|
||||
-- `inputs` and non-consumed `tools`; the inputs/tools split (not a separate
|
||||
-- axis) says whether the item is used up.
|
||||
--
|
||||
-- Template-id matching ({ template="rock" }) is ALSO valid — it is just the
|
||||
-- `form` was RETIRED (ADR-0055 amendment): a physical-shape axis mixed
|
||||
-- geometry, identity and capability. Its functional members became
|
||||
-- affordances; its identity members (a "tree") stay template-id.
|
||||
--
|
||||
-- Template-id matching ({ template="tree" }) is ALSO valid — it is just the
|
||||
-- trivial one-property constraint — and is used where a recipe genuinely wants
|
||||
-- one specific item (see rock_pick/rock_pile in init.lua). Role-based is the
|
||||
-- default here; template-id is one of the options, not the norm.
|
||||
-- one specific item (see rock_pick/rock_pile in init.lua, and chop_tree below).
|
||||
-- Role-based is the default; template-id is one of the options, not the norm.
|
||||
-- =====================================================================
|
||||
return function(c)
|
||||
-- ---- items (each tagged with its ROLE via `form`) ----------------
|
||||
-- NOTE: `rock` (form=lump) and `stick` (form=shaft) are BASE items defined
|
||||
-- in init.lua; this pack's role-based recipes match them by form.
|
||||
-- ---- items (each tagged with the CAPABILITIES it offers) ---------
|
||||
-- NOTE: `rock` (affordance.knappable) and `stick` (affordance.leverage,
|
||||
-- weight 0.3) are BASE items defined in init.lua; this pack's role-based
|
||||
-- recipes match them by affordance the same as pack items.
|
||||
-- World-gathered
|
||||
c.T{ id = "branch", name = "Branch", desc = "A heavy springy branch. Snap it into sticks.",
|
||||
weight = 1.5, vol = 0.006, form = "shaft", material = { wood = 1.0 },
|
||||
weight = 1.5, vol = 0.006, material = { wood = 1.0 },
|
||||
affordance = { leverage = true }, -- a haft candidate, but heavy
|
||||
atlas = "tc", uv = "log_pile1", scale = 0.85 }
|
||||
|
||||
c.T{ id = "log", name = "Log", desc = "A heavy wooden log. Saw it into planks.",
|
||||
weight = 20, vol = 0.05, form = "log", material = { wood = 1.0 },
|
||||
weight = 20, vol = 0.05, material = { wood = 1.0 }, -- raw heavy wood; matched by material+weight
|
||||
atlas = "tc", uv = "log_pile1" }
|
||||
|
||||
c.T{ id = "tree", name = "Tree", desc = "A standing tree. Chop it down for logs.",
|
||||
weight = 400, vol = 1.0, form = "tree", material = { wood = 1.0 },
|
||||
weight = 400, vol = 1.0, material = { wood = 1.0 }, -- one concrete item → matched by template-id
|
||||
atlas = "tc", uv = "log_pile1", scale = 1.6 }
|
||||
|
||||
c.T{ id = "plant_fiber", name = "Plant Fiber", desc = "Tough plant fiber. Twist several into cordage.",
|
||||
weight = 0.05, vol = 0.0002, form = "fiber", material = { fiber = 1.0 },
|
||||
weight = 0.05, vol = 0.0002, material = { fiber = 1.0 },
|
||||
affordance = { spinnable = true }, -- can be twisted; cord itself is NOT spinnable
|
||||
atlas = "tc", uv = "sack1", scale = 0.6 }
|
||||
|
||||
-- Crafted
|
||||
c.T{ id = "sharp_stone", name = "Sharp Stone", desc = "A knapped stone with a cutting edge.",
|
||||
weight = 1, vol = 0.0004, form = "blade", material = { stone = 1.0 },
|
||||
affordance = { cutting = true }, atlas = "tc", uv = "spade" }
|
||||
weight = 1, vol = 0.0004, material = { stone = 1.0 },
|
||||
affordance = { cutting = true }, -- "blade" role = affords cutting
|
||||
atlas = "tc", uv = "spade" }
|
||||
|
||||
c.T{ id = "cordage", name = "Cordage", desc = "Twisted plant-fiber cord. A binding.",
|
||||
weight = 0.1, vol = 0.0003, form = "cord", material = { fiber = 1.0 },
|
||||
weight = 0.1, vol = 0.0003, material = { fiber = 1.0 },
|
||||
affordance = { binding = true }, -- "cord" role = affords binding (NOT spinnable → no re-twist)
|
||||
atlas = "tc", uv = "sack1" }
|
||||
|
||||
c.T{ id = "plank", name = "Plank", desc = "A sawn wooden plank.",
|
||||
weight = 2, vol = 0.004, form = "plank", material = { wood = 1.0 },
|
||||
weight = 2, vol = 0.004, material = { wood = 1.0 }, -- output only; light wood (not re-sawable)
|
||||
atlas = "tc", uv = "bench1" }
|
||||
|
||||
c.T{ id = "stone_axe", name = "Stone Axe", desc = "A hafted stone axe. Chops wood.",
|
||||
weight = 1.8, vol = 0.0012, form = "tool",
|
||||
weight = 1.8, vol = 0.0012,
|
||||
material = { stone = 0.6, wood = 0.3, fiber = 0.1 },
|
||||
affordance = { chopping = true }, atlas = "tc", uv = "spade" }
|
||||
|
||||
c.T{ id = "stone_hammer", name = "Stone Hammer", desc = "A stone lashed to a haft. Pounds and knaps.",
|
||||
weight = 1.5, vol = 0.001, form = "tool",
|
||||
weight = 1.5, vol = 0.001,
|
||||
material = { stone = 0.6, wood = 0.3, fiber = 0.1 },
|
||||
affordance = { hammering = true }, atlas = "tc", uv = "spade" }
|
||||
|
||||
c.T{ id = "sharpened_stick", name = "Sharpened Stick", desc = "A stick whittled to a point. A crude spear.",
|
||||
weight = 0.3, vol = 0.0005, form = "shaft", material = { wood = 1.0 },
|
||||
weight = 0.3, vol = 0.0005, material = { wood = 1.0 },
|
||||
affordance = { piercing = true }, atlas = "tc", uv = "log_pile1", scale = 0.9 }
|
||||
|
||||
-- ---- recipes (match by ROLE, not by item id) --------------------
|
||||
-- knap: any hard stone LUMP + a HAMMERING tool -> a sharp blade.
|
||||
-- ---- recipes (match by CAPABILITY, not by item id) --------------
|
||||
-- knap: any KNAPPABLE stone + a HAMMERING tool -> a cutting edge.
|
||||
-- (rock is knappable; sharp_stone is NOT → no self-recursion.)
|
||||
c.R{ id = "knap_sharp_stone",
|
||||
inputs = { { match = { form = "lump" }, count = 1 } },
|
||||
inputs = { { match = { ["affordance.knappable"] = true }, count = 1 } },
|
||||
tools = { { match = { ["affordance.hammering"] = true } } },
|
||||
outputs = { { template = "sharp_stone", count = 1 } },
|
||||
name = "Knap Sharp Stone",
|
||||
description = "Strike a stone with a hammerstone to flake off a sharp edge." }
|
||||
|
||||
-- cordage: three FIBERS (any fiber source) -> cord.
|
||||
-- cordage: three SPINNABLE fibers (any fiber source) -> cord.
|
||||
-- (cordage is binding-but-not-spinnable → you can't re-twist cord.)
|
||||
c.R{ id = "twist_cordage",
|
||||
inputs = { { match = { form = "fiber" }, count = 3 } },
|
||||
inputs = { { match = { ["affordance.spinnable"] = true }, count = 3 } },
|
||||
outputs = { { template = "cordage", count = 1 } },
|
||||
name = "Twist Cordage",
|
||||
description = "Twist three plant fibers into a length of cordage." }
|
||||
|
||||
-- hammer: a LUMP head + a SHAFT haft + a CORD binding.
|
||||
-- hammer: a heavy STONE head + a LEVERAGE haft + a BINDING.
|
||||
-- head matched the primitive way (material+mass); haft/binding by affordance —
|
||||
-- one recipe, both matching styles, one mechanism (ADR-0055).
|
||||
c.R{ id = "craft_stone_hammer",
|
||||
inputs = {
|
||||
{ match = { form = "lump" }, count = 1 }, -- head
|
||||
{ match = { form = "shaft" }, count = 1 }, -- haft (stick OR branch)
|
||||
{ match = { form = "cord" }, count = 1 }, -- binding
|
||||
{ match = { ["composition.stone"] = ">0.5", weight = ">1" }, count = 1 }, -- head (a stone chunk)
|
||||
{ match = { ["affordance.leverage"] = true }, count = 1 }, -- haft (stick OR branch)
|
||||
{ match = { ["affordance.binding"] = true }, count = 1 }, -- binding
|
||||
},
|
||||
outputs = { { template = "stone_hammer", count = 1 } },
|
||||
name = "Haft Stone Hammer",
|
||||
description = "Lash a stone to a haft for a pounding tool (enables knapping)." }
|
||||
|
||||
-- axe: a BLADE head + a SHAFT haft + a CORD binding.
|
||||
-- axe: a CUTTING head + a LEVERAGE haft + a BINDING.
|
||||
c.R{ id = "craft_stone_axe",
|
||||
inputs = {
|
||||
{ match = { form = "blade" }, count = 1 }, -- head (a sharp stone)
|
||||
{ match = { form = "shaft" }, count = 1 }, -- haft
|
||||
{ match = { form = "cord" }, count = 1 }, -- binding
|
||||
{ match = { ["affordance.cutting"] = true }, count = 1 }, -- head (a sharp stone)
|
||||
{ match = { ["affordance.leverage"] = true }, count = 1 }, -- haft
|
||||
{ match = { ["affordance.binding"] = true }, count = 1 }, -- binding
|
||||
},
|
||||
outputs = { { template = "stone_axe", count = 1 } },
|
||||
name = "Haft Stone Axe",
|
||||
description = "Bind a sharp stone to a haft with cordage." }
|
||||
|
||||
-- break: a HEAVY shaft (branch, not a light stick) -> two sticks.
|
||||
-- break: a HEAVY leverage-thing (branch, not a light stick) -> two sticks.
|
||||
c.R{ id = "break_branch",
|
||||
inputs = { { match = { form = "shaft", weight = ">1" }, count = 1 } },
|
||||
inputs = { { match = { ["affordance.leverage"] = true, weight = ">1" }, count = 1 } },
|
||||
outputs = { { template = "stick", count = 2 } },
|
||||
name = "Break Branch",
|
||||
description = "Snap a heavy branch over your knee into two sticks." }
|
||||
|
||||
-- sharpen: a LIGHT shaft (a stick) + a CUTTING tool -> a pointed stick.
|
||||
-- sharpen: a LIGHT leverage-thing (a stick) + a CUTTING tool -> pointed stick.
|
||||
c.R{ id = "sharpen_stick",
|
||||
inputs = { { match = { form = "shaft", weight = "<1" }, count = 1 } },
|
||||
inputs = { { match = { ["affordance.leverage"] = true, weight = "<1" }, count = 1 } },
|
||||
tools = { { match = { ["affordance.cutting"] = true } } },
|
||||
outputs = { { template = "sharpened_stick", count = 1 } },
|
||||
name = "Sharpen Stick",
|
||||
description = "Whittle a stick to a point with a cutting edge." }
|
||||
|
||||
-- chop: a TREE + a CHOPPING tool -> two logs (closes axe->log->plank).
|
||||
-- chop: THE tree (genuine single item → template-id) + a CHOPPING tool -> logs.
|
||||
-- (Multiple tree species would switch this to an affordance/material match.)
|
||||
c.R{ id = "chop_tree",
|
||||
inputs = { { match = { form = "tree" }, count = 1 } },
|
||||
inputs = { { match = { template = "tree" }, count = 1 } },
|
||||
tools = { { match = { ["affordance.chopping"] = true } } },
|
||||
outputs = { { template = "log", count = 2 } },
|
||||
name = "Chop Tree",
|
||||
description = "Fell a tree with a chopping edge — yields two logs." }
|
||||
|
||||
-- saw: any heavy WOOD (matched by material+weight, not form) + a CUTTING
|
||||
-- tool -> four planks. A light plank (weight 2) is correctly not re-sawable.
|
||||
-- saw: any heavy WOOD (matched by material+mass) + a CUTTING tool -> planks.
|
||||
-- A light plank (weight 2) is correctly not re-sawable.
|
||||
c.R{ id = "saw_planks",
|
||||
inputs = { { match = { ["composition.wood"] = ">0.5", weight = ">5" }, count = 1 } },
|
||||
tools = { { match = { ["affordance.cutting"] = true } } },
|
||||
|
||||
Reference in New Issue
Block a user