board.module
README.md
board
The activity board: which replayable jobs a district offers today, running one,
and remembering what was done so the board changes.
An activity TYPE (content.activities.types) says what unlocks it and how many of its variants a district shows
a day. A VARIANT is a small authored job in the mission runner's shape (steps, a decision, bonus objectives,
rewards by choice, fail rewards): written, not generated. The board deals the day's offers from the variants
that are unlocked and rested, by a shuffle seeded from the day, the type and the district, so the same day
always offers the same jobs and tomorrow offers others. Finishing or failing a variant rests it for its type's
`rest` days; a variant marked `once` (a collectible) never comes back once done.
local Board = require("metropolisGame.logic.board")
local board = Board.new(Activities, hub?, seed) -- content.activities
board:offers(day, progress, "old_quay") -- { { id, type, district, giver } } today's jobs there (all districts when nil)
board:open(typeId, progress) -- whether a type is unlocked
board:start(id, day) -- ok, why ("unknown" | "busy" | "resting" | "done" | "locked")
board.runner -- the mission runner running the active variant (tick / event / choose)
board:active() -- the running variant's id, or nil
board:count(id) board:countType("getaway") -- times completed
board:view(day, progress, district) -- { { id, type, district, giver, state = "offered" | "active" } }
board:serialise() board:restore(data)
`progress` is the mission runner's progress summary (Runner.meets). Hub events are the runner's with the name
"activity" ("activityStarted", "activityStep", "activityChose", "activityDone", "activityFailed", ...); the board
records the day itself by listening to them.
The interface is documented in the header of init.luau; this file repeats it for the asset browser.