FL — the shared constants, geometry, state and event bus of
First Light: The Three Fires.
Every slice requires this and nothing else of each other:
local FL = require("game.FL")
Constants say where things are and how the night is tuned. `FL.state` is
the one live table the loop slice writes and every other slice reads.
`FL.on` / `FL.emit` carry the moments between slices — a fire dying, a
flare, a spoken line — so a slice reacts to what happened without
knowing who made it happen.
fireById(id: string) → void
| arg | type | description |
|---|
| id | string | |
progress( ) → number
Night progress in [0, 1]; 1 is first light.
remaining( ) → number
Seconds of night left, 0 once first light has come.
on(name: string, fn: (...any) → void
| arg | type | description |
|---|
| name | string | |
| fn | (...any | |
emit(name: string, ...: ?) → void
| arg | type | description |
|---|
| name | string | |
| ... | ? | |
request(action: string) → void
A screen or a stage asks the loop for something.
| arg | type | description |
|---|
| action | string | |
say(who: string, text: string, key: string, seconds: number?) → void
A line somebody speaks. The sound slice plays it, the screens slice
captions it, whoever has the moment calls it.
| arg | type | description |
|---|
| who | string | |
| text | string | |
| key | string | |
| seconds | number? | |
lineFor(key: string) → void
| arg | type | description |
|---|
| key | string | |
lineSeconds(text: string) → number
How long a caption for this line should hold, from its own length.
| arg | type | description |
|---|
| text | string | |
speak(key: string) → void
Speak one of the written lines. Unknown keys are logged rather than
silently dropped, because a missing cue is invisible on screen otherwise.
| arg | type | description |
|---|
| key | string | |
dist2(ax: number, az: number, bx: number, bz: number) → number
| arg | type | description |
|---|
| ax | number | |
| az | number | |
| bx | number | |
| bz | number | |
stationAt(x: number, z: number, reach: number?) → string
The nearest station to a point: the well or an altar, within `reach`.
Returns "well" | fireId | nil.
| arg | type | description |
|---|
| x | number | |
| z | number | |
| reach | number? | |
nearestLitFire(x: number, z: number) → void
The nearest LIT fire to a point, or nil when all three are dark.
| arg | type | description |
|---|
| x | number | |
| z | number | |
localBody( ) → void
This peer's own body, or nil before the player has spawned.