The pack
thrustRules
function thrustRules(): Pack<{ thrustRules: typeof api }>
Install the thrust-rules API (game.thrustRules): its rules for cave-flyer and its preset.
Helpers
POD
const POD: "pod"
The pod's id in the thrust-craft world.
podOf
function podOf(state: CaveState): PodState | undefined
The pod's state in a session, or undefined without podRule.
podRule
function podRule(o: PodOptions = {}): CaveRule
Thrust's pod: the objective is to tow it out through the orbit line. The ship needs a beam with a pod setting.
While towing, the view follows the middle of the ship and the pod, and the beam cannot take cells.
reactorCritical
const reactorCritical = (state: CaveState): boolean=> …
The reactor is critical: counting down, or blown.
reactorOf
function reactorOf(state: CaveState): ReactorState | undefined
The reactor's state in a session, or undefined without reactorRule.
reactorRule
function reactorRule(o: ReactorOptions): CaveRule
Thrust's reactor. Bases marked gated hold fire while it is stunned or counting down. A crash while it is critical
ends the planet as destroyed (no bonus, the next mission's guns punished by gunLevel.destroyed).
THRUST_GRAVITY
const THRUST_GRAVITY: number[]
Gravity per planet in pixels/s^2: the ROM's gravity_FRAC (5, 7, 9, 11, 12, 13)/256 y units per active tick.
THRUST_SHIP_OUTLINE
const THRUST_SHIP_OUTLINE: Vec2[]
Thrust's ship, drawn upright (nose up): an arrowhead with a notched tail.
thrustGunCone
function thrustGunCone(param: number): { dir: number; spread: number }
A gun's fire cone from its gun_param: angle index = base + rnd(0..spread mask) + rnd(0..3), 0 up, clockwise.
thrustPlanets
function thrustPlanets(): CavePlanetDef[]
Thrust's planets as cave-flyer planets.
thrustPreset
function thrustPreset(o: ThrustPresetOptions = {}): CaveFlyerDef
Thrust (1986). Easy and Normal change only the guns' fire rate (x0.4, x0.7), the starting fuel (2000, 1500) and the spare ships (5, 4); Arcade is the ROM: 1000 fuel, three spare ships, an extra ship every 10,000.
Types
PodOptions
interface PodOptions
The pod rule's options.
bonus?: { per: number; offset: number; destroyed: number }— The mission bonus for towing it out:perx (planet index +offset), plusdestroyedif the reactor is critical.
PodState
interface PodState
The pod's state.
pod: "stand" | "towed" | "lost" | "none"— On its stand, towed, lost with the ship, or none on this planet.deathPod: boolean— It was on the rod when the ship died.
ReactorOptions
interface ReactorOptions
The reactor's numbers (the original's units: damage bytes, seconds converted from its ticks).
damage: number— Damage at the start of each planet.hitRandom: number— Random damage added per hit: 0 to this.critical: number— Damage over this starts the countdown.stunPerDamage: number— The guns stay quiet for the new damage times this many seconds.startStun: number— Stun at the start of a planet and after a respawn, seconds.countdown: number— Counts in the countdown.countdownStep: number— Seconds per count.
ReactorState
interface ReactorState
The reactor's state.
damage: number— Accumulated damage.stun: number— Seconds the guns stay quiet.countdown: number— Countdown count, -1 when not critical.countT: number— Seconds to the next count.alive: boolean— Still standing.present: boolean— This planet has a reactor.
ThrustPresetOptions
interface ThrustPresetOptions
Options for thrustPreset.
difficulty?: CaveDifficulty— Easy, Normal or Arcade (the ROM's tables). Default 'arcade'.seed?: number— Seed for gun aim and reactor damage.guns?: number— Multiply the guns' fire rate. Default from the difficulty.gravity?: number— Multiply every planet's gravity. Default 1.lives?: number— Spare ships at the start. Default from the difficulty (3 in the arcade).fuel?: number— Starting fuel. Default from the difficulty (1000).podMass?: number— Pod mass relative to the ship. Default 1 (the ROM's midpoint physics: thrust halves when towing).tether?: "rod" | "rope"— Tow on a rigid rod (the original) or a rope.planets?: number[]— Which planets, by index 0-5, in play order. Default all six.


