Log inGet started
World

Escapement

Branchmain
Branchesmain
Commit7683e73a7f

README.md

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

FieldWhat it does
followSharpnessHow hard a body catches up to the point its address resolves to.
turnSharpnessHow fast a piece turns to its heading — automata face outward, blight faces in.
autoMusterMuster 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.