LSDE Dialog Engine / DialogueEngine
Class: DialogueEngine
Defined in: engine.ts:25
LSDE Dialog Engine — callback-driven graph dispatcher.
Implements
Constructors
Constructor
new DialogueEngine():
DialogueEngine
Returns
DialogueEngine
Methods
getActiveScenes()
getActiveScenes():
SceneHandle[]
Defined in: engine.ts:145
Get all currently active scene handles.
Returns
Implementation of
IDialogueEngine.getActiveScenes
getCurrentBlocks()
getCurrentBlocks():
BlueprintBlock[]
Defined in: engine.ts:149
Get the current block of every active scene.
Returns
Implementation of
IDialogueEngine.getCurrentBlocks
getSceneConnections()
getSceneConnections(
sceneId):BlueprintConnection[]
Defined in: engine.ts:158
Get connections for a scene (for inter-scene navigation).
Parameters
sceneId
string
Returns
Implementation of
IDialogueEngine.getSceneConnections
init()
init(
options):DiagnosticReport
Defined in: engine.ts:41
Validate blueprint data, build internal graph, return diagnostic report.
Parameters
options
Returns
Implementation of
isRunning()
isRunning():
boolean
Defined in: engine.ts:141
True if at least one scene is active.
Returns
boolean
Implementation of
onAction()
onAction(
handler):void
Defined in: engine.ts:102
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:86
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:94
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:98
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:90
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:82
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:65
Register a global character resolver. Called for every block with metadata.characters.
Parameters
fn
(characters) => BlockCharacter | undefined
Returns
void
Implementation of
IDialogueEngine.onResolveCharacter
onResolveCondition()
onResolveCondition(
evaluator):void
Defined in: engine.ts:69
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
(condition) => boolean
Returns
void
Implementation of
IDialogueEngine.onResolveCondition
onSceneEnter()
onSceneEnter(
handler):void
Defined in: engine.ts:106
Register a handler called when any scene starts.
Parameters
handler
Returns
void
Implementation of
onSceneExit()
onSceneExit(
handler):void
Defined in: engine.ts:110
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:78
Register a handler called before each block to validate it.
Parameters
handler
Returns
void
Implementation of
IDialogueEngine.onValidateNextBlock
scene()
scene(
sceneId):SceneHandle
Defined in: engine.ts:114
Create a scene handle. Does NOT start the flow — call handle.start().
Parameters
sceneId
string
Returns
Implementation of
setChoiceFilter()
setChoiceFilter(
evaluator):void
Defined in: engine.ts:74
Parameters
evaluator
(condition) => boolean
Returns
void
Deprecated
Use onResolveCondition() instead.
Implementation of
IDialogueEngine.setChoiceFilter
setLocale()
setLocale(
locale):void
Defined in: engine.ts:52
Set the active locale for text resolution.
Parameters
locale
string
Returns
void
Implementation of
stop()
stop():
void
Defined in: engine.ts:135
Stop all active scenes.
Returns
void
