Skip to content

DriveContext

Defined in: tools/lab/src/grammar/drive.ts:59

C extends ControlSchema = ControlSchema

controls: ControlValues<C>

Defined in: tools/lab/src/grammar/drive.ts:63

What the controls were set to when the run started.


events: object

Defined in: tools/lab/src/grammar/drive.ts:76

The engine’s event log. The run is the only thing issuing frames, so waitFor has to be started before the frames that satisfy it and awaited after — awaiting it first parks the run with nothing left to advance it:

const hit = events.waitFor("enemy:hit", { withinFrames: 60 });
await step(60);
await hit;

clearLog: () => void

void

getLog: () => EventLogEntry[]

EventLogEntry[]

isEnabled: () => boolean

boolean

setCapacity: (n) => void

number

void

setEnabled: (enabled) => void

Turn event-log recording on/off at runtime. Off means zero per-event allocation: the EventBus tap detaches and recordBusEvent is never called. DebugConfig.eventLog controls the startup default; this is the runtime switch for toggling mid-session.

boolean

void

waitFor: (pattern, options?) => Promise<EventLogEntry>

string | RegExp

"entity" | "bus"

number

Promise<EventLogEntry>


expect: ExpectStatic

Defined in: tools/lab/src/grammar/drive.ts:85

Jest-style assertions: expect(hp).toBeLessThan(before).


input: DriveInput

Defined in: tools/lab/src/grammar/drive.ts:64


scene: Scene

Defined in: tools/lab/src/grammar/drive.ts:61

The scene the run drives. findByKey reaches what the scenario spawned.

capture(label?): Promise<string>

Defined in: tools/lab/src/grammar/drive.ts:90

Screenshots the canvas into the run’s result and resolves with the same PNG data URL.

string

Promise<string>


step(frames?, opts?): Promise<void>

Defined in: tools/lab/src/grammar/drive.ts:78

Advances frames frames, one at a time.

number

DriveStepOptions

Promise<void>


until(predicate, opts?): Promise<number>

Defined in: tools/lab/src/grammar/drive.ts:83

Advances a frame at a time until predicate holds, and resolves with the number it took. Rejects after maxFrames (600 by default).

() => boolean

DriveUntilOptions

Promise<number>