CutsceneDirector

class CutsceneDirector
devtools/src/cutscene.ts:128

Members

constructor

constructor(host: Host, scripts: readonly CutsceneScript[]) → CutsceneDirector
hostHost
Undocumented
scriptsreadonly CutsceneScript[]
Undocumented

lastOutcome

lastOutcome() → CutsceneOutcome | null

How the last scene left, or null if none ever has — or, for a scene held on its last frame, that it ended while it is still on stage.

status() answers "is a scene playing" and goes null for three different reasons; this is what tells them apart. Without it a caller has to reconstruct the answer from a null and a remembered playhead — the cinema player did, with a half-second window around the final frame, and stopCutscene from the console read as an ending because it produced the identical evidence.

Cleared by play, so it always describes the last scene rather than an older one, and by a seek away from a held end.

list

list() → readonly { description: string; id: string; seconds: number; soundtrack: string | null }[]

peek

peek(frame: number) → CinematicSample | null

Sample a frame without moving the playhead.

sample is the host's per-frame ask and it owns the playhead: it anchors the epoch on its first call and records lastRenderTime, which is the instant seek re-bases against. So a second caller wanting a different frame cannot go through it — the picture would chase whatever the last asker wanted. The track overlay is that second caller: it takes a central difference of the hull's camera-relative offset half a frame either side of the one on screen, which is a velocity that stays correct while paused and while seeking, where differencing consecutive rendered frames gives zero and then a spike.

The script's sample is pure by contract (see PreparedCutscene), so this is only as expensive as the arithmetic and touches no state at all.

Frames outside the scene are clamped rather than declined: a central difference at frame 0 legitimately asks for −0.5.

framenumber
Undocumented

play

play(id: string, options: PlayOptions) → CutsceneStatus
idstring
Undocumented
optionsPlayOptions
Undocumented

sample

sample(renderTime: number) → CinematicSample | null

The frame's cinematic state, or null when nothing is playing.

Called by the host once per rendered frame with the snapshot's renderTime. The first call anchors frame 0; the final frame restores the player and returns null, so a host needs no separate end-of-scene check — unless the scene was played with hold, in which case it stays.

renderTimenumber
Undocumented

seek

seek(frame: number) → CutsceneStatus

Jump the playhead to a reference frame. With the clock paused this gives frame-exact stills — the capture loop the verification pipeline needs.

framenumber
Undocumented

status

status() → CutsceneStatus | null

stop

stop() → void

Stop and restore. Safe to call when nothing is playing.