Skip to content

LSDE Dialog Engine / DialogueEngine

Class: DialogueEngine ​

Defined in: engine.ts:26

LSDE Dialog Engine — callback-driven graph dispatcher.

Implements ​

Constructors ​

Constructor ​

new DialogueEngine(): DialogueEngine

Returns ​

DialogueEngine

Methods ​

getActiveScenes() ​

getActiveScenes(): SceneHandle[]

Defined in: engine.ts:195

Get all currently active scene handles.

Returns ​

SceneHandle[]

Implementation of ​

IDialogueEngine.getActiveScenes


getCurrentBlocks() ​

getCurrentBlocks(): Block[]

Defined in: engine.ts:199

Get the current block of every active scene.

Returns ​

Block[]

Implementation of ​

IDialogueEngine.getCurrentBlocks


getSceneConnections() ​

getSceneConnections(sceneRef): BlueprintConnection[]

Defined in: engine.ts:215

Every wire INSIDE a scene, flattened so each carries the block it leaves.

Graph inspection, for a debug view that wants to see the wiring without playing it. It has never had anything to do with going from one scene to another: a wire has never crossed a scene in any version of the format, and chaining two scenes is the game's own business.

Parameters ​

sceneRef ​

string

Returns ​

BlueprintConnection[]

Implementation of ​

IDialogueEngine.getSceneConnections


init() ​

init(options): DiagnosticReport

Defined in: engine.ts:68

Load a payload and report what is wrong with it.

Takes one export, or the several files of a per-scene one — each of those carries the whole header, so they are folded into a single payload after checking they come from one export.

The engine is initialized only when there are no errors: a payload it cannot read leaves it unusable rather than half-loaded.

Parameters ​

options ​

InitOptions

Returns ​

DiagnosticReport

Implementation of ​

IDialogueEngine.init


isRunning() ​

isRunning(): boolean

Defined in: engine.ts:191

True if at least one scene is active.

Returns ​

boolean

Implementation of ​

IDialogueEngine.isRunning


onAction() ​

onAction(handler): void

Defined in: engine.ts:127

Register a global handler for ACTION blocks. The developer MUST handle execution in this handler.

Parameters ​

handler ​

ActionHandler

Returns ​

void

Implementation of ​

IDialogueEngine.onAction


onBeforeBlock() ​

onBeforeBlock(handler): void

Defined in: engine.ts:111

Register a handler called before every block. Must call resolve() to continue.

Parameters ​

handler ​

BeforeBlockHandler

Returns ​

void

Implementation of ​

IDialogueEngine.onBeforeBlock


onChoice() ​

onChoice(handler): void

Defined in: engine.ts:119

Register a global handler for CHOICE blocks. All choices are provided, tagged with visible when onResolveCondition() is configured.

Parameters ​

handler ​

ChoiceHandler

Returns ​

void

Implementation of ​

IDialogueEngine.onChoice


onCondition() ​

onCondition(handler): void

Defined in: engine.ts:123

Register a global handler for CONDITION blocks. The developer MUST handle evaluation in this handler.

Parameters ​

handler ​

ConditionHandler

Returns ​

void

Implementation of ​

IDialogueEngine.onCondition


onDialog() ​

onDialog(handler): void

Defined in: engine.ts:115

Register a global handler for DIALOG blocks. May return a cleanup function.

Parameters ​

handler ​

DialogHandler

Returns ​

void

Implementation of ​

IDialogueEngine.onDialog


onInvalidateBlock() ​

onInvalidateBlock(handler): void

Defined in: engine.ts:107

Register a handler called when a block fails validation.

Parameters ​

handler ​

InvalidateBlockHandler

Returns ​

void

Implementation of ​

IDialogueEngine.onInvalidateBlock


onResolveCharacter() ​

onResolveCharacter(fn): void

Defined in: engine.ts:95

Register a global character resolver. Called for every block with metadata.characters.

Parameters ​

fn ​

(actors) => Card | undefined

Returns ​

void

Implementation of ​

IDialogueEngine.onResolveCharacter


onResolveCondition() ​

onResolveCondition(evaluator): void

Defined in: engine.ts:99

Install a unified condition evaluator for both choice visibility and condition block pre-evaluation. The engine handles choice: conditions internally via choice history — this callback evaluates game-state conditions only.

When installed:

  • Choice blocks: each choice is tagged with visible: true | false based on its visibilityConditions.
  • Condition blocks: each group is pre-evaluated and the result is available in context.groups[i].result and context.evaluation.

Parameters ​

evaluator ​

(test) => boolean

Returns ​

void

Implementation of ​

IDialogueEngine.onResolveCondition


onSceneEnter() ​

onSceneEnter(handler): void

Defined in: engine.ts:131

Register a handler called when any scene starts.

Parameters ​

handler ​

SceneLifecycleHandler

Returns ​

void

Implementation of ​

IDialogueEngine.onSceneEnter


onSceneExit() ​

onSceneExit(handler): void

Defined in: engine.ts:135

Register a handler called when any scene ends (natural or cancelled).

Parameters ​

handler ​

SceneLifecycleHandler

Returns ​

void

Implementation of ​

IDialogueEngine.onSceneExit


onValidateNextBlock() ​

onValidateNextBlock(handler): void

Defined in: engine.ts:103

Register a handler called before each block to validate it.

Parameters ​

handler ​

ValidateNextBlockHandler

Returns ​

void

Implementation of ​

IDialogueEngine.onValidateNextBlock


scene() ​

scene(sceneRef): SceneHandle

Defined in: engine.ts:147

Open a scene by its path (reactor_breach) or by its stable id (sc_u0vqg2g8).

Take the id wherever the reference is stored OUTSIDE the payload — a Unity asset, a save file, a database row. The path is what a writer reads and what builds the i18n keys, but it changes the day someone renames the scene, and a serialized path then stops resolving with no compiler to catch it. The id survives a rename; show the path as its label.

Parameters ​

sceneRef ​

string

Returns ​

SceneHandle

Implementation of ​

IDialogueEngine.scene


setLocale() ​

setLocale(locale): void

Defined in: engine.ts:82

Set the active locale for text resolution.

Parameters ​

locale ​

string

Returns ​

void

Implementation of ​

IDialogueEngine.setLocale


stop() ​

stop(): void

Defined in: engine.ts:180

Cancel every running scene.

Every one of them, even if a cleanup throws on the way. A scene left running after stop() is a dialogue the game can no longer see or reach, and one handler's failure must not do that to the scenes after it — the same rule a scene already applies to its own tracks. The first fault surfaces once there is nothing left to close.

Returns ​

void

Implementation of ​

IDialogueEngine.stop