strict
Where a mood lands on THIS machine. moodKit re-implements no sky, weather or post effect:
it hands each mood to the kits a world already has through adapters, and fills in from the
engine whatever no kit covers. Kits plug in with `A.register(name, adapter)`; moodKitBridges
ships one small component per kit (worldClockKit, alpineKit, styleKit, platformer3dKit,
campaignKit) that does it, so moodKit itself names no other kit and installs on its own.
Built in:
* `stars` every ProceduralSky's star field.
* `native` when no adapter owns the light (worldClockKit's director does): the scene's sun
(direction, colour, intensity), the ProceduralSky hour and gradient, the engine's
height fog and surface weather (wet ground, settled snow); when no adapter owns the
grade (alpineKit's does): moodKit's colour grade on the engine's `colorGrade` pass.
Nothing here is synced: every write is this machine's view.
warnOnce(key: string, msg: string) → void
| arg | type | description |
|---|
| key | string | |
| msg | string | |
register(name: string, adapter: Adapter) → void
Plug a kit in: from now on every mood this machine shows is handed to `adapter` too. Registering the same name again replaces it (safe on hot reload). Returns an unregister function.
| arg | type | description |
|---|
| name | string | |
| adapter | Adapter | |
get(name: string) → Adapter
The registered adapter called `name`, or nil.
| arg | type | description |
|---|
| name | string | |
setEnabled(name: string, on: boolean) → void
Turn an adapter off (or back on) on this machine: a registered name, "stars" or "native".
| arg | type | description |
|---|
| name | string | |
| on | boolean | |
enabled(name: string) → boolean
| arg | type | description |
|---|
| name | string | |
isReady(ad: Adapter) → boolean
| arg | type | description |
|---|
| ad | Adapter | |
rescan( ) → void
Forget the cached sweep of the scene, so the next write looks again.
watchComponent(name: string) → void
Ask the sweep to note whether any entity carries component `name` (an adapter uses it, e.g. worldClockKit's "WorldClock").
| arg | type | description |
|---|
| name | string | |
sceneHas(name: string) → boolean
Whether the last sweep saw component `name` (see `watchComponent`).
| arg | type | description |
|---|
| name | string | |
available( ) → Map
Which adapters this machine uses right now: every registered one that is ready, plus stars and native.
lookQuat(f: { number }) → void
quaternion {x,y,z,w} turning -Z onto `f` (unit), keeping world up where it can
| arg | type | description |
|---|
| f | { number } | |
sunDirection(hour: number) → void
Direction TOWARD the sun (unit {x,y,z}) for an hour: rises in the east (+x) at 6, highest at 12, sets in the west at 18.
| arg | type | description |
|---|
| hour | number | |
sunFor(m: Map) → Map
The native sun for a mood: { dir (toward the light), color, intensity }. Daylight follows the sun's height; at night a moon opposite the sun gives a cold low light (warm amber for a `lantern` mood).
surfaceFor(m: Map) → Map
The ground's wetness and settled snow for a mood: its own `surface`, else what its weather implies.
remember(key: string, fn: () → void
| arg | type | description |
|---|
| key | string | |
| fn | ( | |
nativeGrade(m: Map) → void
apply(m: Map, opts: Map?) → Map
Lay a resolved mood on this machine: every registered adapter that is ready, then the stars, then the engine's own sun / sky / fog / wet ground and grade for what no adapter owns. `opts.fade` (seconds) is how long a kit takes to fade its weather and sky; `opts.entries` maps ramp / ink / paper to style stack entry ids. Called every step of a blend. Returns which adapters took it.
| arg | type | description |
|---|
| m | Map | |
| opts | Map? | |
clear( ) → void
Take this machine's mood off everywhere: every adapter's per-machine settings, the sun and sky as they were, no moodKit fog, wet ground or grade.
setStack(entries: { Map }?, options: Map?) → void
Say which synced style stack this world's moods paint on ({ id, block, settings } entries and stack options); the style adapter (moodKitBridges.StyleBridge) keeps it in place. LevelMoods sets it from its data file.
| arg | type | description |
|---|
| entries | { Map }? | |
| options | Map? | |
stack( ) → Map
The stack set with `setStack`: { entries, options } or nil.
applyPerformance(opts: Map?) → boolean
Per-machine shadow budget for big open levels: coarser distant shadow pages (`detailBias`, default 2) and small or far casters stop casting (`minRadiusPx` 3, `maxDistance` 90). Runs once per machine per settings; pass a table to change them, `force = true` to run again.
| arg | type | description |
|---|
| opts | Map? | |