Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld b0f23b4e-e…

rules

The one module every part of First Light requires: `require("firstlight.rules")`.

byPolar Night·posted 1mo ago
What it does

firstlight.rules

The one module every part of First Light requires: require("firstlight.rules").

It holds the game's numbers (day length, temperatures, calorie burn, stove fuel rates, bear ranges, starting stores), the layout of the station and the sites around it, the shared blackboard M.state, the event bus M.events, and the clock.

The clock

M.tick(dt) is called once per play frame by the scene entrypoint. It advances M.state.run.elapsed, derives M.state.clock (day, fraction of day, hour, sun elevation, twilight openness) and emits day, noon and firstLight. M.sleepToMorning() jumps to 07:00 next day; M.restore(elapsed) rebuilds the clock from a persisted run.

Pure helpers: sunElevation(day, t), twilightSeconds(day), airC(day, t), windChill(airC, windMs), progress(day), rng(seed, salt), dist2d.

The blackboard

M.state has one section per slice. A slice writes its own section and reads the others: run, clock, weather, body, hut, stores, bear, journal.

Events

M.events.on(name, fn) returns an unsubscribe function; M.events.emit(name, payload) calls every listener. The names and payloads are listed at the top of init.luau. M.say(text, seconds) emits say for the HUD.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

strict

on(name: string, fn: (any) → void

argtypedescription
namestring
fn(any

emit(name: string, payload: any) → void

argtypedescription
namestring
payloadany

say(text: string, seconds: number?) → void

argtypedescription
textstring
secondsnumber?

clamp(x: number, lo: number, hi: number) → number

argtypedescription
xnumber
lonumber
hinumber

lerp(a: number, b: number, t: number) → number

argtypedescription
anumber
bnumber
tnumber

progress(day: number) → number

0..1 progress through the polar night, day 1 → day 30.

argtypedescription
daynumber

twilightSeconds(day: number) → number

Real seconds of twilight the noon of `day` holds.

argtypedescription
daynumber

sunElevation(day: number, t: number) → number

Sun elevation in degrees at fraction `t` of `day`. Peaks at noon. Below zero every day but the last, when noon clears the horizon for a few minutes.

argtypedescription
daynumber
tnumber

twilightFromElevation(elev: number) → number

How open the twilight window is, 0..1, as a function of sun elevation. Civil twilight ends at -6°, nautical at -12°.

argtypedescription
elevnumber

airC(day: number, t: number) → number

Air temperature before wind chill on `day`, with a colder dip around midnight.

argtypedescription
daynumber
tnumber

windChill(airC: number, windMs: number) → number

Wind chill, °C, for air temperature `airC` and wind `windMs` (m/s).

argtypedescription
airCnumber
windMsnumber

tick(dt: number) → void

argtypedescription
dtnumber

sleepToMorning( ) → void

Jump the clock to 07:00 of the next day. The body slice calls this on sleep.

restore(elapsed: number) → void

Restore the clock from a persisted run (the body slice calls this on load).

argtypedescription
elapsednumber

rng(seed: number, salt: number) → void

A deterministic stream from the world's forecast seed, so a journal written on one run is true on the next.

argtypedescription
seednumber
saltnumber

dist2d(ax: number, az: number, bx: number, bz: number) → number

Distance on the plain, ignoring height.

argtypedescription
axnumber
aznumber
bxnumber
bznumber

clockText( ) → string

The clock as a readable string for HUD and journal.

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

3items
This part has no composite children. See the Files segment for its leaf payloads.
backing path · firstlight/rules.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.