Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

DayClockTrait

const DayClockTrait: Trait<{ dayLengthSeconds: number; hourAtTick: number; pausedTick: number | null; tick: number; }>

A Landscape’s day clock, as an anchor the hour is derived from: the hour at tick, the real seconds a whole day takes, and the tick it was paused at, or null while it runs. Nothing writes it while it runs, so a room sends it once a change rather than every step; findTimeOfDay derives the hour at the tick it reads. hourAtTick and dayLengthSeconds are kept at the stream’s precision, so a page derives the room’s hour to the bit. Nothing saves it, so every load opens at the same hour unless a Landscape is given its own. Read-only to a game, which writes it with setTimeOfDay, setDayLength, pauseDayClock and resumeDayClock.