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

persist

The run's durable memory, in the world's runtime data under `firstlight/`. `require("firstlight.persist")`.

byPolar Night·posted 1mo ago
What it does

firstlight.persist

The run's durable memory, in the world's runtime data under firstlight/. require("firstlight.persist").

Persisted sections of Rules.state: run, body, hut, stores, journal — one leaf each (firstlight/run, firstlight/body, ...).

  • Persist.load() — read the saved sections over the blackboard and restore the clock from run.elapsed. Returns whether a save existed.
  • Persist.save(reason?) — write every section now.
  • Persist.markDirty() — ask for a save at the next throttle window.
  • Persist.tick(dt) — per frame; flushes a marked or detected change every few seconds (a store or structural value written straight onto the blackboard is detected by fingerprint).
  • Persist.ensureSeed() — choose run.seed once per world and save it.
  • Persist.hasSave(), Persist.wipe().

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

store( ) → void

fingerprint( ) → string

A short string that changes when a store or a structural value changes, so a slice writing the blackboard directly is still caught by the throttled save.

overlay(into: { [string]: any }, from: any) → void

Copy every key of `from` over `into`, so a save written by an older version of the blackboard keeps the defaults it never knew about.

argtypedescription
into{ [string]: any }
fromany

overlayJournal(from: any) → void

The journal is a list; a save holds it as a JSON array (or an empty object when it was empty), so rebuild it in order.

argtypedescription
fromany

hasSave( ) → boolean

Whether a save exists for this world.

load( ) → boolean

Read the saved sections over the blackboard and restore the clock. Returns true when a save existed.

save(reason: string?) → void

Write every persisted section now. `reason` names the moment for the log.

argtypedescription
reasonstring?

markDirty( ) → void

Ask for a save at the next throttle window.

tick(dt: number) → void

Per-frame: flush a pending or detected change once every few seconds.

argtypedescription
dtnumber

ensureSeed( ) → number

The forecast seed is chosen once per world, the first time the game ever loads, and never again.

wipe( ) → void

Forget the save entirely; the next load starts a fresh world.

Sub-parts

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

7items
▣
module · born here
❒asset
# 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.
▲ 0↑ born
backing path · firstlight/persist.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.