HazardDirector
The wreck's temper. Lives on the scene's `RunDirector`, attached by `game/wiring/hazard`.
HazardDirector
The wreck's temper. Lives on the scene's RunDirector, attached by
game/wiring/hazard.
It owns the two decisions no individual hazard can make for itself.
When a structural member lets go. Past RULES.CFG.collapseAtInstability
(2) a timer runs down and the next cross-brace in the truss releases. The
interval shortens with every plate taken off the wreck, so the shaft you flew
in through is not the shaft you fly out of.
How much junk is adrift. Past RULES.CFG.debrisAtInstability (3) chunks
wake up, four more per point of instability. A disabled entity does not tick,
so a sleeping chunk cannot wake itself — this is the one place that decides.
Which brace and which chunks is by sorted name, never random: every peer
runs the scene entrypoint and builds its own copy of the rig, so two players
in the same shaft must be dodging the same beam. (entity.findAll returns
matches in whatever order the world holds them, which is not spawn order and
is not the same on two peers — hence the sort.)
collapseNow()
local name = entity.find("RunDirector").component.get("HazardDirector"):collapseNow()
Force the next member to let go, now, and get its name back (or nil when the
wreck has nothing left to shed). The hazard slice's own test lever, and the
hook another slice would use to stage a scripted beat.
Reading a run from outside
Component VMs are their own worlds, so the slice's counters are mirrored onto
public fields here every frame and can be read from any execute:
instability · ventsArmed / collapseArmed / debrisArmed ·
nextCollapseIn · collapses · lastCollapse · ventFires · ventHits ·
debrisHits · impacts · awakeChunks · frames
and, for the route into flight:
impulseEntry (the method name and arity it resolved — applyImpulse/3 in
this world) · impulses · impulsesDropped. A run where impulsesDropped
climbs and impulses does not is a hazard slice that is damaging you but not
moving you.
Scoped to this part · feeds back into the world's score.