Log inGet started
World

First Light

Branchmain
Branchesmain
Commit5b1bfa8dc1

README.md

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.