Skip to content

ScriptedSession beta ​

Interface of @v12-engine/client/testing

ts
export interface ScriptedSession extends GameSession

A session that plays the snapshots it is given, one each update, for a test of what the screen makes of them: the first is snapshot(), what a snapshot leaves out is empty (tick its place in the list), and the commands sent are kept (sent) and answered with their number. The map is flat (terrain, 64 by 64 cells where not given) and the game's data is registry (empty where not given); the rest of the session as the test gives it

ts
// scriptedSession, of `@v12-engine/client/testing`
const session = scriptedSession([{ entities: [] }, { entities: [soldier] }], { registry: world.registry })
state.apply(session.snapshot())
for (const snapshot of session.update(0.1)) state.apply(snapshot)

Members ​

push ​

ts
push(...snapshots: Partial<Snapshot>[]): void;

Snapshots more, played after those left

sent ​

ts
readonly sent: PlayerCommand[];

The commands sent, in order