Log inGet started
World

Cinder Crown

Branchmain
Branchesmain
Commit4b7bf04196

README.md

CinderDirector

The run. One instance, on GameRoot. It owns cinder.state and is the only thing that writes it.

Every tick it advances the eruption clock, drives the lava lake up the crater, lets the hazard throw lava bombs, keeps the player on the surface of the mountain, and decides when the run is won or lost.

Public API

CallWhat it does
beginRun()Start or restart a run from the top, from any phase. Resets the clock, the lava, the pylons, the heat and every hazard, and puts the player back at cinder.spawnPoint(). No scene reload.
finish(result)End the run — "won", "lost:lava" or "lost:bombs". Clears the sky of bombs and emits run.end.
damage(cause)Take one heat point. Ignored during i-frames. Emits player.hit, and player.died + finish at zero.
countArmed()How many pylons are armed, counted from the pylons themselves.
placePlayer(x, z)Put the local avatar on the ground at a world XZ, at rest.

Restarting

The restart control on the cinderRun input map (R on a keyboard, Start on a pad, an on-screen button on a phone) calls beginRun(). Any other slice can call beginRun() directly for its own restart affordance — it is safe from idle, running, won and lost alike, and two calls in a row are the same as one.

Fields

FieldDefaultMeaning
autoStarttrueBegin a run the moment play starts.
lavaEntitylava_lakeThe entity whose top face is the lava surface.
inputMap@me::hazard.cinderRunWhere the restart control comes from.
drownGrace1.5Seconds into a run before the lava can drown anyone.
fallRescueY-25Below this world Y the player has left the mountain.

Losing

  • Drowned — the player is under the lava surface, inside the lake's own horizontal extent (read from the lake entity, so it follows whatever the lake is scaled to). The test arms only once the player has been seen above the lava, so the frames before the avatar reaches its spawn can never read as a drowning at the world origin.
  • Out of time — the eruption reaches 1.0. By then the lake is over the rim crest, so the crown is under it either way; both report lost:lava.
  • Out of heat — three bomb impacts inside CFG.bombRadius.

The mountain is solid

cinder.groundHeight is this game's single definition of where the ground is — the terrain heightmap was baked from it. The director enforces that definition: a player below the surface at their own XZ is put back onto it, and one who has left the terrain entirely is put back at their last XZ on the mountain. Neither costs heat, and neither fires while the character controller is standing on the terrain by itself. This runs in every phase, before the phase gate, so the player is on the mountain on the won card and the lost card too.

Hot reload

The bus subscriptions are parked in @me::hazard.cinderRuntime under the key CinderDirector, so a reload takes the previous incarnation's handlers down and leaves every other slice's alone. The armed-pylon count is recomputed from the pylons rather than incremented, so a duplicated event cannot inflate it.