rtsKit.registry - what the scene holds that the match needs to know
about: resource nodes and structures (town halls, barracks, towers), keyed by
entity id, and the live match on this machine. Components register here as
they wake, on every machine, so the host's simulation and every screen's
view read the same list.
changed(kind: string, id: string, info: any?) → void
| arg | type | description |
|---|
| kind | string | |
| id | string | |
| info | any? | |
on(fn: (string, string, any?) → void
Hear nodes and structures come and go: fn(kind, id, info?) with kind "node+", "node-", "structure+", "structure-". Returns a stop function.
| arg | type | description |
|---|
| fn | (string, string, any? | |
addNode(id: string, comp: any) → void
| arg | type | description |
|---|
| id | string | |
| comp | any | |
removeNode(id: string, comp: any?) → void
Forget a node. Pass the component that registered it: when a reload wakes the new one before the old one is destroyed, the new one stays.
| arg | type | description |
|---|
| id | string | |
| comp | any? | |
addStructure(id: string, comp: any) → void
| arg | type | description |
|---|
| id | string | |
| comp | any | |
removeStructure(id: string, comp: any?) → void
Forget a structure. Pass the component that registered it: when a reload wakes the new one before the old one is destroyed, the new one stays.
| arg | type | description |
|---|
| id | string | |
| comp | any? | |
onEvent(name: string, fn: (any) → void
Hear a match event on this machine: spawned, died, delivered, depleted, defeated, trained, refused. Returns a stop function.
| arg | type | description |
|---|
| name | string | |
| fn | (any | |
emit(name: string, data: any) → void
| arg | type | description |
|---|
| name | string | |
| data | any | |
damageStructure(id: string, amount: number, byId: number?) → void
Hurt a structure through SecondWind (host). No SecondWind health on it: nothing happens.
| arg | type | description |
|---|
| id | string | |
| amount | number | |
| byId | number? | |
structureAlive(id: string) → boolean
Is this structure still standing (SecondWind alive, or no health at all)?
| arg | type | description |
|---|
| id | string | |
structureHealth(id: string) → number
A structure's health as a fraction 0..1 (1 when it has no SecondWind health).
| arg | type | description |
|---|
| id | string | |