api
The Lights front door: `local Lights = require("eerieLightsKit.api")`. `setState(target, state, delay?)`, `setGroup(tag, state)`, `setStyle`, `circuit(name, on, { stagger, delay, short, from })`, `silhouette(target, action)`, reads (`state`, `levelOf`, `list`, `styles`, `resolve`…
eerieLightsKit.api
The Lights front door: local Lights = require("eerieLightsKit.api"). setState(target, state, delay?), setGroup(tag, state), setStyle, circuit(name, on, { stagger, delay, short, from }), silhouette(target, action), reads (state, levelOf, list, styles, resolve), setQuality, and on("stateChanged", fn). Targets are an entity, id, name, glob or tag. Owner-authoritative: writes on other peers are sent to the light's owner. Also runs the shadow budget (only the nearest N shadow-casting lights keep shadows).
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2strict
ent(id: string) → any
A registered light id that is not (or no longer) an entity answers a plain Lua error, which the callers catch, instead of an engine error log from entity(id).
| arg | type | description |
|---|---|---|
| id | string |
now( ) → number
connected( ) → boolean
on(name: string, fn: (any) → void
Listen to an event: "stateChanged" { entity, state, style }. Fires on every peer when it sees a light change state. Returns a disconnect function.
| arg | type | description |
|---|---|---|
| name | string | |
| fn | (any |
_emit(name: string, payload: any) → void
| arg | type | description |
|---|---|---|
| name | string | |
| payload | any |
_register(id: string, pub: any) → any
| arg | type | description |
|---|---|---|
| id | string | |
| pub | any |
_unregister(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
writePower(power: number) → void
| arg | type | description |
|---|---|---|
| power | number |
_setLit(id: string, lit: boolean) → void
Whether a placed light is shining (LightBehavior reports it). Keeps every scene root's `power` value current.
| arg | type | description |
|---|---|---|
| id | string | |
| lit | boolean |
power( ) → number
1 while any placed light shines, 0 when every one is dark, nil before any light reported.
_lights( ) → void
tagsOf(L: any) → void
| arg | type | description |
|---|---|---|
| L | any |
nameOf(id: string) → string
| arg | type | description |
|---|---|---|
| id | string |
globMatch(name: string, pat: string) → boolean
| arg | type | description |
|---|---|---|
| name | string | |
| pat | string |
resolve(target: any) → void
Every LightBehavior id a target names (entity, id, name, glob or tag), in a stable order.
| arg | type | description |
|---|---|---|
| target | any |
isOwner(id: string) → boolean
| arg | type | description |
|---|---|---|
| id | string |
apply(id: string, field: string, value: any, at: number?) → void
| arg | type | description |
|---|---|---|
| id | string | |
| field | string | |
| value | any | |
| at | number? |
_hookNet( ) → void
send(ids: { string }, field: string, value: any, at: number?) → void
| arg | type | description |
|---|---|---|
| ids | { string } | |
| field | string | |
| value | any | |
| at | number? |
setState(target: any, state: string, delay: number?) → number
Set the state of the light(s) a target names: "on" | "off" | "flicker" | "short" (spark, pop, dark) | "restore" (stutters back on). `delay` seconds puts the change in the future (every peer switches at the same moment). Returns how many lights it reached.
| arg | type | description |
|---|---|---|
| target | any | |
| state | string | |
| delay | number? |
setGroup(tagOrName: string, state: string, delay: number?) → number
Same as setState, named for groups: `Lights.setGroup("hall", "off")`.
| arg | type | description |
|---|---|---|
| tagOrName | string | |
| state | string | |
| delay | number? |
setStyle(target: any, style: string) → number
Switch the style of the light(s) a target names.
| arg | type | description |
|---|---|---|
| target | any | |
| style | string |
point(p: any) → vector
A world point from any of the forms the horror kits take: `{ x, y, z }`, `{ x = , y = , z = }`, a vector, an entity, or an entity's name or id. nil when it names nothing.
| arg | type | description |
|---|---|---|
| p | any |
circuit(name: string, on: boolean, opts: any?) → number
A power circuit: every light whose `circuit` field is `name`. on = false: all die together (short-out with a pop when `opts.short`). on = true: they come back one by one, `opts.stagger` seconds apart (default 0.6, in name order or nearest-first from `opts.from`), each stuttering back on.
| arg | type | description |
|---|---|---|
| name | string | |
| on | boolean | |
| opts | any? |
d(id: string) → number
| arg | type | description |
|---|---|---|
| id | string |
state(target: any) → string
The state of one light ("on", "off", ...), or nil.
| arg | type | description |
|---|---|---|
| target | any |
levelOf(target: any) → number
The output this peer computes for a light now, 0..~1.8 (times its authored intensity).
| arg | type | description |
|---|---|---|
| target | any |
list( ) → void
Every light: { { id, name, style, state, circuit, group, level } }.
styles( ) → void
Every style id.
setQuality(q: string) → void
Quality: "high" (4 placed lights may cast shadows, updates out to 60 m), "medium" (2, 45 m), "low" (1, 30 m). Until a game calls this, the kit follows the device on its own (`M.autoQuality`); "auto" hands it back.
| arg | type | description |
|---|---|---|
| q | string |
_applyQuality(q: string) → void
| arg | type | description |
|---|---|---|
| q | string |
autoQuality( ) → string
The quality this device should run: the engine's quality tier (which a graphics setting such as graphicsPresets moves), held to "medium" on a tablet and "low" on a phone (a handheld GPU, an Android build, or a touch browser whose short side is under 1000 points).
followQuality( ) → void
quality( ) → string
_cullDistance( ) → number
_registerSilhouette(id: string, pub: any?) → void
| arg | type | description |
|---|---|---|
| id | string | |
| pub | any? |
silhouette(target: any, action: string, delay: number?) → number
Drive Silhouette figures named by entity, name, glob or tag (their `group` attribute): "play" starts the walk on every peer at once (after `delay` s), "stop" holds it at the start, "show" / "hide" toggle shadowOnly figures' existence by moving them back to the start. Owner-side writes; on another peer the request is sent to the owner.
| arg | type | description |
|---|---|---|
| target | any | |
| action | string | |
| delay | number? |
entityPos(id: string) → vector
| arg | type | description |
|---|---|---|
| id | string |
camPos( ) → vector
_shadowAllowed(id: string) → boolean
Whether a light may cast shadows this moment (re-picked twice a second).
| arg | type | description |
|---|---|---|
| id | string |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ 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".
Scoped to this part · feeds back into the world's score.