RunDirector
The run of HULLBREAKER, from the briefing card to the last breath. One instance, on the scene's `RunDirector` entity, attached by `game/wiring/shell`.
RunDirector
The run of HULLBREAKER, from the briefing card to the last breath. One
instance, on the scene's RunDirector entity, attached by
game/wiring/shell.
It is the single writer of game.rules state.phase, o2, integrity,
banked, instability and cutsMade. Nothing else should write those:
report what happened on the event bus and this component decides what the
run does about it.
What it does
- The clock.
o2counts down in real seconds while the phase isrunning, and only then, so the briefing and the end cards cost no air. It is the run's only timer. - The state machine.
briefing→running→won/lost, emittingphase(newPhase)on every transition.- Won when
banked >= CFG.quotaTonnesand the player is withindockRadiusof the skiff's cargo maw. Banking the quota out in the wreck is not a win; you still have to get home. - Lost when
o2reaches 0 (deadReason = "air") orintegrityreaches 0 (deadReason = "breach").
- Won when
- The events it consumes.
event effect severed(pieceId, tonnes)cutsMade + 1,instability + CFG.instabilityPerCut(capped), then emitsinstability(level)deposited(pieceId, tonnes)banked + tonnes(falls back toRULES.tonnesOf(pieceId)if no tonnage is passed)impact(amount, source)integrity - amount, floored at 0, ignored outsiderunning - The screens.
hb_visor(the instrument layer, layer 20, shown only while running) andhb_card(the full-frame briefing / won / lost card, layer 40). Both are built bygame.hudfrom a snapshot this component assembles each refresh — including where the skiff falls on the glass.
Fields
| field | default | meaning |
|---|---|---|
dockRadius | 9.0 | metres from the cargo maw that count as docked |
previewInEdit | false | draw the HUD in edit mode too |
refreshHz | 30.0 | how often the instrument layer is rebuilt |
previewInEdit is off by default so authoring captures are not covered by
a HUD nobody asked for; the run only draws itself in play.
Two things worth knowing before you change it
- The event handlers are installed once per
game.rulesload, guarded by a flag on the rules module rather than on this chunk. A component reload re-runs this file with fresh module locals, so a guard here would add a second copy of every handler on every hot-reload and every edit↔play flip. - Nothing on the instrument layer carries a CSS animation. The layer is
re-registered several times a second and a re-render restarts an
animation, so a keyframe pulse would sit frozen on its first frame. The
warning blink is a computed
blinkvalue in the snapshot instead. The cards do animate — they are registered once per phase and left alone.
Buttons
onCallback handles hb_begin (start the run) and hb_restart (reset to
briefing, then begin on the next tick, so a slice resetting on phase sees
the briefing settle first). Both buttons also answer the Return key.
Scoped to this part · feeds back into the world's score.