Log inGet started
World

Hullbreaker

Branchmain
Branchesmain
Commitcdbe4bf730

README.md

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. o2 counts down in real seconds while the phase is running, 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, emitting phase(newPhase) on every transition.
    • Won when banked >= CFG.quotaTonnes and the player is within dockRadius of the skiff's cargo maw. Banking the quota out in the wreck is not a win; you still have to get home.
    • Lost when o2 reaches 0 (deadReason = "air") or integrity reaches 0 (deadReason = "breach").
  • The events it consumes.
    eventeffect
    severed(pieceId, tonnes)cutsMade + 1, instability + CFG.instabilityPerCut (capped), then emits instability(level)
    deposited(pieceId, tonnes)banked + tonnes (falls back to RULES.tonnesOf(pieceId) if no tonnage is passed)
    impact(amount, source)integrity - amount, floored at 0, ignored outside running
  • The screens. hb_visor (the instrument layer, layer 20, shown only while running) and hb_card (the full-frame briefing / won / lost card, layer 40). Both are built by game.hud from a snapshot this component assembles each refresh — including where the skiff falls on the glass.

Fields

fielddefaultmeaning
dockRadius9.0metres from the cargo maw that count as docked
previewInEditfalsedraw the HUD in edit mode too
refreshHz30.0how 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.rules load, 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 blink value 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.