DriveContext
Defined in: tools/lab/src/grammar/drive.ts:59
Type Parameters
Section titled “Type Parameters”C extends ControlSchema = ControlSchema
Properties
Section titled “Properties”controls
Section titled “controls”controls:
ControlValues<C>
Defined in: tools/lab/src/grammar/drive.ts:63
What the controls were set to when the run started.
events
Section titled “events”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
Section titled “clearLog”clearLog: () =>
void
Returns
Section titled “Returns”void
getLog
Section titled “getLog”getLog: () =>
EventLogEntry[]
Returns
Section titled “Returns”EventLogEntry[]
isEnabled
Section titled “isEnabled”isEnabled: () =>
boolean
Returns
Section titled “Returns”boolean
setCapacity
Section titled “setCapacity”setCapacity: (
n) =>void
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
setEnabled
Section titled “setEnabled”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.
Parameters
Section titled “Parameters”enabled
Section titled “enabled”boolean
Returns
Section titled “Returns”void
waitFor
Section titled “waitFor”waitFor: (
pattern,options?) =>Promise<EventLogEntry>
Parameters
Section titled “Parameters”pattern
Section titled “pattern”string | RegExp
options?
Section titled “options?”source?
Section titled “source?”"entity" | "bus"
withinFrames?
Section titled “withinFrames?”number
Returns
Section titled “Returns”Promise<EventLogEntry>
expect
Section titled “expect”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.
Methods
Section titled “Methods”capture()
Section titled “capture()”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.
Parameters
Section titled “Parameters”label?
Section titled “label?”string
Returns
Section titled “Returns”Promise<string>
step()
Section titled “step()”step(
frames?,opts?):Promise<void>
Defined in: tools/lab/src/grammar/drive.ts:78
Advances frames frames, one at a time.
Parameters
Section titled “Parameters”frames?
Section titled “frames?”number
Returns
Section titled “Returns”Promise<void>
until()
Section titled “until()”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).
Parameters
Section titled “Parameters”predicate
Section titled “predicate”() => boolean
Returns
Section titled “Returns”Promise<number>