UnitHost
The five automata and the rust-blight, in the world. One of these sits on the scene's `Units` entity.
UnitHost
The five automata and the rust-blight, in the world. One of these sits on the
scene's Units entity.
Every unit body is a child of UnitBodies, named body_<unitId>. The unit
record itself lives in Core.state().units and belongs to the referee; this
component creates the record when it musters a unit, then only reads it back to
place the body, and writes unit.entity so the rest of the game can get from a
record to the thing on screen.
Nothing here decides where a unit is. A body only chases the world point its
gear-local address resolves to at Core.visual.tick, which is why the machine
turning under a unit is what carries it.
What the other slices call
local host = entity.find("Units").component.get("UnitHost")
host:muster("blight", "canker", 3, 11) -- a new piece: record + body
host:runBlight() -- the rust's whole turn
host:describe("automaton_3") -- "Anvil — wound 6/6"
runBlight is idempotent per tick, and the host also runs the blight off the
phaseChanged signal, so the rust climbs whichever way the turn reaches it.
muster always parents the new body to this host's live UnitBodies, whatever
container is passed, so a caller holding a stale one after a rematch still gets
a piece that appears.
Fields
| Field | What it does |
|---|---|
followSharpness | How hard a body catches up to the point its address resolves to. |
turnSharpness | How fast a piece turns to its heading — automata face outward, blight faces in. |
autoMuster | Muster the opening roster when the match starts with an empty board. |
The look of the pieces, the winding gauge, the seized state and how the blight
thinks all live in game.units.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2game/UnitHost.component — the five automata and the rust-blight, in the world. OWNED BY THE "units" SLICE. The scene's build.luau attaches exactly one of these, to an entity named "Units", and never changes again. This is the thin shell. The substance — what each automaton is built out of, how a wound spring is drawn, what a seized automaton looks like, and the whole of the blight's turn — lives in `game.units`, so it can be read and reloaded without touching the scene. Every unit body is a child of "UnitBodies", named `body_<unitId>`. That naming is the CONTRACT — the UI slice raycasts against these to let the commander click a unit, and the rules slice never touches them. The unit RECORD lives in `Core.state().units` and belongs to the referee. This component creates the record when it musters a unit, then only ever reads it back to place the body. It writes `unit.entity` so the rest of the game can get from a record to the thing on screen.
clearSubscriptions( ) → void
sweepBodies( ) → void
Ownership is re-derived from the world, never from a module local, so a hot-reload or an edit/play flip cannot leave a second set of bodies. Every entity this slice has ever put in the world, by name. Despawning the container is not enough on its own: a body whose parent went away in the same frame it was created is left standing in the world with no parent at all, and the next muster then draws a second one on top of it. Sweeping by name catches those, wherever in the hierarchy they ended up.
freshRoot( ) → void
root( ) → void
`entity(id)` on an id that is gone is an error-level log line, and this runs every reconcile, so the existence check comes first.
musterAll( ) → void
Muster the five automata and one blight at every vent. Where they START is the units slice's call: the automata hold the inner two rings, the rust comes in at the rim.
unitCount( ) → number
findDirector( ) → void
awake( ) → void
onDestroy( ) → void
muster(side: string, kind: string, ring: number, sector: number, container: any) → string
`root` is accepted for callers that already hold the container, but the body always goes under THIS host's live "UnitBodies". A caller that captured the container before a rematch is holding a despawned entity, and a body parented to one of those is a piece that never appears.
| arg | type | description |
|---|---|---|
| side | string | |
| kind | string | |
| ring | number | |
| sector | number | |
| container | any |
runBlight( ) → any
describe(unitId: string) → string
| arg | type | description |
|---|---|---|
| unitId | string |
reconcile( ) → void
A body without a record is cleaned up, a record without a body gets one. This is what makes the host self-healing across a hot-reload of either file.
update(dt: number) → void
| arg | type | description |
|---|---|---|
| dt | number |
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.