▣
module · drop-in viewer
ns
The shared contract of *First Light: Nearside*. Every slice of the game requires this module and nothing else of each other's.
by·posted 1mo ago
What it does
ns
The shared contract of First Light: Nearside. Every slice of the game requires this module and nothing else of each other's.
local NS = require("game.ns")
What it carries
- Constants —
NS.ROUTE(the corridor:startZ,finishZ,halfWidth),NS.DAWN(the terminator's start, speed and the hot/cold distances),NS.CARGO,NS.FUEL,NS.ROVER,NS.PALETTE,NS.AUDIO,NS.NAMES(the entity names the scene authors) andNS.COMPONENTS(the component identities the entrypoint mounts). - The light —
NS.lightAt(dz)andNS.bandAt(dz)read the sunlight at a distance from the dawn line,dz = z - terminatorZ. The rules and the lighting both read these, so the meter and the picture agree. - The screen —
NS.screen()andNS.unit(fraction): every layout is stated against the live screen size, never in pixels chosen for one frame. - Events —
NS.on(name, fn)/NS.emit(name, payload); the names are inNS.EVENTS. - Phases —
NS.phase(),NS.setPhase(p),NS.resume(),NS.tick(dt),NS.runTime(). Phases:title → howto → intro → playing ⇄ paused → won | lost. - Surfaces —
NS.provide(name, table)/NS.get(name)/NS.whenProvided(name, fn). The shapes are in/zero/source/design/spec.md. - Maths —
clamp,lerp,smooth,approach,hash,rgb.
Notes
- Module-local state (phase, surfaces, handlers) resets on hot reload of
this file; components re-provide their surfaces in
awake. - The route runs north, +Z. South of the terminator is sunlight.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.