refactor(vagrant): v0.17.0 — extract Stone-Age content to content/stone_age.lua (T1-modder content packs via content facade)

This commit is contained in:
calic
2026-07-28 12:01:45 +00:00
parent ff9d50937d
commit e9085c0317
4 changed files with 163 additions and 228 deletions

95
content/stone_age.lua Normal file
View File

@@ -0,0 +1,95 @@
-- =====================================================================
-- content/stone_age.lua — T1-modder content pack: Stone-Age items + recipes.
--
-- PURE CONTENT. No engine wiring, no sprite/atlas plumbing — just the
-- authoring API `c` passed in by the module (see init.lua's content facade):
-- 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
-- `c.T` auto-registers the crafting-panel icon from the item's own sprite.
--
-- A T1 modder adds Stone-Age content by editing THIS file only — never
-- init.lua. Drop a sibling `content/<name>.lua` + list it in init.lua's
-- CONTENT_PACKS to add a new pack.
--
-- Self-bootstrapping graph:
-- rock --knap--> sharp_stone --+--(tool)--> saw_planks (log -> 4 planks)
-- +--(head)--> stone_axe
-- plant_fiber x3 --twist--> cordage --(binding)--> stone_axe
-- stick --------------------------(haft)--------> stone_axe
-- =====================================================================
return function(c)
-- ---- items -------------------------------------------------------
-- World-gathered
c.T{ id = "log", name = "Log",
desc = "A heavy wooden log. Saw it into planks with a cutting edge.",
weight = 20, vol = 0.05, material = { wood = 1.0 },
atlas = "tc", uv = "log_pile1" }
c.T{ id = "sharp_stone", name = "Sharp Stone",
desc = "A knapped stone with a cutting edge. A tool — not consumed by sawing.",
weight = 1, vol = 0.0004, material = { stone = 1.0 },
affordance = { cutting = true }, atlas = "tc", uv = "spade" }
c.T{ id = "plant_fiber", name = "Plant Fiber",
desc = "A strand of tough plant fiber. Twist three into cordage.",
weight = 0.05, vol = 0.0002, material = { fiber = 1.0 },
atlas = "tc", uv = "sack1", scale = 0.6 }
-- Crafted outputs
c.T{ id = "plank", name = "Plank",
desc = "A sawn wooden plank.",
weight = 2, vol = 0.004, material = { wood = 1.0 }, -- light: not re-sawable (<5)
atlas = "tc", uv = "bench1" }
c.T{ id = "cordage", name = "Cordage",
desc = "A length of twisted plant-fiber cord.",
weight = 0.1, vol = 0.0003, material = { fiber = 1.0 },
atlas = "tc", uv = "sack1" }
c.T{ id = "stone_axe", name = "Stone Axe",
desc = "A hafted stone axe. Chops wood.",
weight = 1.8, vol = 0.0012,
material = { stone = 0.6, wood = 0.3, fiber = 0.1 },
affordance = { chopping = true }, atlas = "tc", uv = "spade" }
-- ---- recipes -----------------------------------------------------
-- saw_planks: input matched by MATERIAL (mostly wood AND heavy), a light
-- plank fails weight>5. Needs a cutting TOOL (not consumed). ×4 output.
c.R{ id = "saw_planks",
inputs = { { match = { ["composition.wood"] = ">0.5", weight = ">5" }, count = 1 } },
tools = { { match = { ["affordance.cutting"] = true } } },
outputs = { { template = "plank", count = 4 } },
name = "Saw Planks",
description = "Saw a wooden log into four planks (needs a cutting edge)." }
c.R{ id = "knap_sharp_stone",
inputs = { { template = "rock", count = 1 } },
outputs = { { template = "sharp_stone", count = 1 } },
name = "Knap Sharp Stone",
description = "Strike a rock to flake off a sharp-edged stone." }
c.R{ id = "twist_cordage",
inputs = { { template = "plant_fiber", count = 3 } },
outputs = { { template = "cordage", count = 1 } },
name = "Twist Cordage",
description = "Twist three plant fibers into a length of cordage." }
c.R{ id = "craft_stone_axe",
inputs = {
{ template = "sharp_stone", count = 1 }, -- head (consumed)
{ template = "stick", count = 1 }, -- haft
{ template = "cordage", count = 1 }, -- binding
},
outputs = { { template = "stone_axe", count = 1 } },
name = "Haft Stone Axe",
description = "Bind a sharp stone to a stick with cordage." }
-- ---- world spawns (backpack sits at 350,400) ---------------------
c.S{ template = "log", x = 110, y = 400 }
c.S{ template = "sharp_stone", x = 110, y = 330 }
for i = 1, 3 do
c.S{ template = "plant_fiber", x = 50, y = 300 + (i - 1) * 28 }
end
end