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
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
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
Returns
Implementation of
isRunning()
isRunning():
boolean
Defined in: engine.ts:191
True if at least one scene is active.
Returns
boolean
Implementation of
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
Returns
void
Implementation of
onBeforeBlock()
onBeforeBlock(
handler):void
Defined in: engine.ts:111
Register a handler called before every block. Must call resolve() to continue.
Parameters
handler
Returns
void
Implementation of
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
Returns
void
Implementation of
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
Returns
void
Implementation of
onDialog()
onDialog(
handler):void
Defined in: engine.ts:115
Register a global handler for DIALOG blocks. May return a cleanup function.
Parameters
handler
Returns
void
Implementation of
onInvalidateBlock()
onInvalidateBlock(
handler):void
Defined in: engine.ts:107
Register a handler called when a block fails validation.
Parameters
handler
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 | falsebased on itsvisibilityConditions. - Condition blocks: each group is pre-evaluated and the result is available in
context.groups[i].resultandcontext.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
Returns
void
Implementation of
onSceneExit()
onSceneExit(
handler):void
Defined in: engine.ts:135
Register a handler called when any scene ends (natural or cancelled).
Parameters
handler
Returns
void
Implementation of
onValidateNextBlock()
onValidateNextBlock(
handler):void
Defined in: engine.ts:103
Register a handler called before each block to validate it.
Parameters
handler
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
Implementation of
setLocale()
setLocale(
locale):void
Defined in: engine.ts:82
Set the active locale for text resolution.
Parameters
locale
string
Returns
void
Implementation of
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
