on(name: string, fn: (...any) → void
| arg | type | description |
|---|
| name | string | |
| fn | (...any | |
edge(name: string, minGap: number?) → boolean
| arg | type | description |
|---|
| name | string | |
| minGap | number? | |
emit(name: string, ...: any) → void
| arg | type | description |
|---|
| name | string | |
| ... | any | |
registerLamp(ent: any, position: { number }) → Lamp
Handing the same standard over twice answers with the record it already
has rather than making a second one. Two slices reach this — the `fen`
dresses the anchors, and the `loop` registers the bare ones if nothing
has by the time the night starts — and a module reload can put either of
them through it again. Fourteen lamps in a seven-lamp game is a night
nobody can finish, and nothing would say so.
| arg | type | description |
|---|
| ent | any | |
| position | { number } | |
nearestLamp(pos: { number }, onlyLit: boolean?) → void
Distance is measured ON THE GROUND, not through the air. A standard is a
tall iron thing on a fen with relief in it: the vagant stands beside one on
a bank a metre and a half up, or wades to its foot a metre down, and in
both cases is at the lamp. Counting the height difference would make the
reach of a relight, and the size of a lamp's pool of safety, depend on how
the ground happened to be carved under it.
| arg | type | description |
|---|
| pos | { number } | |
| onlyLit | boolean? | |
playSfx(name: string, where: any?) → void
| arg | type | description |
|---|
| name | string | |
| where | any? | |
uiUnit( ) → number
Layout helpers. THE GAME IS FILMED AT 1080x1440 (3:4, TALLER THAN WIDE)
and published to every other shape at once, so no slice may write a pixel
position. Ask these instead — they read the LIVE screen every call.
The shorter screen axis, the unit every UI size should be a fraction of.
isPortrait( ) → boolean
true when the screen is taller than it is wide — the filmed shape, and the
shape a phone held upright is. Stack in portrait; a row may spread in wide.
u(fraction: number) → number
A size as a share of the SHORT axis, so type and buttons keep their
proportion on a phone, a laptop and a television alike.
| arg | type | description |
|---|
| fraction | number | |
cameraFit( ) → void
How far the camera should sit back. A tall frame shows less across, so it
comes in closer and cranes a little higher; a wide one pulls back.
lerp(a: number, b: number, t: number) → number
Small shared maths every slice was going to write anyway.
| arg | type | description |
|---|
| a | number | |
| b | number | |
| t | number | |
smoothstep(t: number) → number
| arg | type | description |
|---|
| t | number | |
dawnAmount( ) → number
0 while it is night, rising to 1 at first light. The fen, the sky, the HUD
and the score all read the dawn off this one function.
timeLeft( ) → void
Minutes:seconds left of the night, for the HUD.
isHidden( ) → boolean
Is the vagant hidden right now? The one question the jaseys ask.
conspicuity( ) → number
How brightly the vagant reads to a jasey, 0..1. Hooded is invisible; dark
is faint; a full lantern in the open is a beacon.
buildFallbackProbe( ) → void
The fen publishes its ditch network as `fen.layout` — the cuts, how wide
each one is, where its bed sits and where the water line is. That IS the
geometry the ground is carved to, so until a purpose-built probe arrives
the depth is read off it rather than guessed: dry at the bank, deepest in
the middle, and no deeper than a ford where a crossing is marked.
provideWater(fn: (number, number) → void
| arg | type | description |
|---|
| fn | (number, number | |
waterDepthAt(x: number, z: number) → number
| arg | type | description |
|---|
| x | number | |
| z | number | |
provideLoop(d: LoopDriver) → void
| arg | type | description |
|---|
| d | LoopDriver | |
hasLoop( ) → boolean
Is anything answering `beginRound` / `restart` right now? The `loop` slice
asks every frame and re-registers when the answer is no. Without that the
one state a player cannot escape is possible: a title card whose only
button calls into a registry that quietly holds nothing.
drive(name: string, arg: any?) → void
| arg | type | description |
|---|
| name | string | |
| arg | any? | |
setMenu(open: boolean) → void
| arg | type | description |
|---|
| open | boolean | |