▣
module · drop-in viewer
state
The run, as every other slice sees it. This is the surface to call; the director is the component behind it, and nobody else has to find it.
by·posted 1mo ago
What it does
run.state
The run, as every other slice sees it. This is the surface to call; the director is the component behind it, and nobody else has to find it.
local Run = require("run.state")
Run.phase() -- "title" | "opening" | "play" | "crest" | "won" | "lost"
Run.tideT() -- 0..1, how far to the crest
Run.tideY() -- the water's world Y this frame
Run.station() -- 1..5, the next unanswered post (6 = all answered)
Run.stationRecord() -- that post's row out of Rules.STATIONS
Run.isGateShut(id) -- is the causeway still barred at this post?
Run.secondsLeft()
Run.isLive() -- play or crest
Run.isOver() -- won or lost
Every read answers even before the director has awoken, so a screen or a heron written against this is safe during a world load.
Three things a screen presses:
Run.begin() -- title -> opening (the Start button)
Run.openingDone() -- opening -> play (the stage slice, when its shot ends)
Run.restart() -- any -> title (the Again button)
They also answer Rules.SIGNAL.UI_CLICK: emitting it with "start",
"begin" or "play" begins the run, and "restart", "again" or
"retry" restarts it — so a screen that only raises the signal still drives
the run.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.