rules
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. -->
rules
<!-- zero:scaffolded-readme --> <!-- Replace the line below with what this module provides and who consumes it, then delete both comment lines. -->TODO: describe this module.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2game/rules — the shared contract every slice of SLAG SAINT codes against. This module is the ONLY thing the build slices share. It holds the tuning numbers, the live battle state, an event bus, a sound-clip registry and the palette. Nothing here reaches into another slice: a slice raises an event or reads state, and whoever cares is listening. local Rules = require("game.rules") Rules.on("boss:damaged", function(p) ... end) Rules.emit("hit", { point = p, surface = "bronze", power = 1 }) The screen is 1080x1440 — PORTRAIT, 3:4. Every layout decision stacks down the tall axis; horizontal room is the scarce resource.
on(event: string, fn: (any) → void
Subscribe to an event. Returns a function that unsubscribes.
| arg | type | description |
|---|---|---|
| event | string | |
| fn | (any |
emit(event: string, payload: any?) → void
Raise an event. Handler errors are reported and do not stop the others.
| arg | type | description |
|---|---|---|
| event | string | |
| payload | any? |
clearListeners(event: string?) → void
Drop every handler for one event, or all of them. Used by the boot component when the world reloads.
| arg | type | description |
|---|---|---|
| event | string? |
setMode(mode: string) → void
Convenience writers — use these instead of poking state directly, so the HUD, the sound and the camera all hear about it.
| arg | type | description |
|---|---|---|
| mode | string |
phaseSpec( ) → any
setPhase(n: number) → void
| arg | type | description |
|---|---|---|
| n | number |
phaseForHealth(fraction: number) → number
Health fraction -> which phase that fraction belongs to.
| arg | type | description |
|---|---|---|
| fraction | number |
shake(amplitude: number, duration: number) → void
| arg | type | description |
|---|---|---|
| amplitude | number | |
| duration | number |
hitstop(duration: number) → void
| arg | type | description |
|---|---|---|
| duration | number |
say(key: string, speaker: string, text: string) → void
Raise a spoken line. The sound slice plays the clip if it has one; the UI slice ALWAYS shows `text`, so a failed generation is a quiet line, not a lost one.
| arg | type | description |
|---|---|---|
| key | string | |
| speaker | string | |
| text | string |
registerClip(key: string, clip: any) → void
Register a `.soundClip` asset under a key. Sound slice only.
| arg | type | description |
|---|---|---|
| key | string | |
| clip | any |
clip(key: string) → any
Look a clip up. nil means the sound slice has not made it yet — callers must survive that rather than erroring.
| arg | type | description |
|---|---|---|
| key | string |
clipKeys( ) → void
sfx(key: string, opts: any?) → void
Ask for a one-shot. The sound slice listens for this and plays it through whatever source is right; if nothing is listening yet, it is a no-op.
| arg | type | description |
|---|---|---|
| key | string | |
| opts | any? |
anchor(role: string) → any
Resolve a scene anchor by role. Returns nil before the scene has loaded.
| arg | type | description |
|---|---|---|
| role | string |
playerBody( ) → any
The local player's body, or nil while it is still spawning. Never stash the result: re-resolve every time.
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
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.