feat(packages): ludic.crafting - recipes as an open registry, can / take / refund / make through a pack port, stations through a port, the hold-to-make, a Crafted fact

A recipe is `def CraftRecipes key { out, n, ins: [...], ns: [...], station, minutes, hold,
group, learned }`. The pack is the CraftPack port (count, take, add, room, and `leaves`: what
an item leaves once used, so water gives back its bottle); stations are CraftStations (ready,
start), unbound meaning hands only. craft_make hands a click recipe over or starts a timed one
at its station, refunding when the station refuses; the hold runs from the screen that shows it.
Uses ludic.base only; ten tests with a fake pack and fake stations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 06:37:57 +03:00
parent 7f8a7ea7ed
commit cc9cec922a
9 changed files with 475 additions and 0 deletions

View file

@ -0,0 +1,12 @@
# system.ludic - crafting as a system: a reset, and nothing saved (a hold never outlives its
# screen; what a station holds is the station's)
export function craft_reset() -> void {
craft_hold_stop()
q_clear(craft_facts())
}
export function craft_system() -> System {
let s = system_new("crafting", PH_SIMULATE)
s.reset = fn craft_reset
return s
}