Files
JiboOs/docs/flow/FlowExecutor.js

90 lines
3.1 KiB
JavaScript
Raw Normal View History

2026-03-16 13:53:01 +02:00
/**
* Interface specifying what Overrides may be provided during FlowExecutor creation.
* @param {Blackboard} [blackboard] Override the default blackboard object for this flow.
* @param {Object} [notepad] Provide your own notepad object instead of the default one.
* @param {Object} [params] Provide parameters to the Flow code.
* @param {EventEmitter} [emitter] Provide your own emitter object instead of the default one shared with behavior trees.
* @param {jibo.flow.FlowExecutor} [flowExecutor] Provide your own Class for the FlowExecutor (primarly used with DebugFlowExecutor).
* @param {Boolean} [enableLogging] Turn on detailed logging as the flow executes.
* @param {Environment} [environment] Provide a pre-populated FlowEnvironment (normally an empty one is created automatically).
* @param {String} [assetPack] The asset pack name to use for loading assets in this tree.
*/
/**
* Class representing a FlowExecutor.
* The FlowExecutor runs a FlowRoot.
* @class FlowExecutor
* @memberof jibo.flow
*/
/**
* Step the primary flow and all parallel flows.
* @method jibo.flow.FlowExecutor#update
* @returns {boolean}
*/
/**
* Step the flow engine.
* This is overridden by the DebugFlowExecutor so
* that it may intervene in the execution process.
*/
/**
* Start the Flow Executor.
* This is effectively a nop since all the work is done through update().
* @method jibo.flow.FlowExecutor#start
*/
/**
* When FlowExecutor starts
* @event jibo.flow.FlowExecutor#start
*/
/**
* Called to stop the Flow Executor.
*
* 1) Stop the current activity.
* 2) Emit `stop` to stop update ticks.
* @method jibo.flow.FlowExecutor#stop
* @return {Promise<void>} A promise that resolves after any asynchronous cleanup has been performed.
*/
/**
* When FlowExecutor stops.
* @event jibo.flow.FlowExecutor#stop
*/
/**
* Called when the Flow executor has finished naturally (not via stop or exception).
* We simply emit events indicating that.
*/
/**
* Send `stop` to the current activity of the Flow Executor in the primary thread.
* @method jibo.flow.FlowExecutor#stopCurrentActivity
*/
/**
* Send `stop` to the current activity of the Flow Executor in the primary thread of the given context.
* @method jibo.flow.FlowExecutor#stopCurrentActivityInContext
*/
/**
* Destroy the FlowExecutor.
* Stop the primary thread and destroy all parallel flows within its scope.
* The flow is no longer runnable.
* @method jibo.flow.FlowExecutor#destroy
*/
/**
* Stop all the parallel flows.
* @method jibo.flow.FlowExecutor#destroyAsyncFlows
* @param {array} contexts the list of stack frames containing async flows to be destroyed
*/
/**
* Stop and Destroy this flow.
* The flow is no longer runnable.
* @method jibo.flow.FlowExecutor#stopAndDestroy
* @return {Promise<void>} A promise that resolves after any asynchronous cleanup has been performed.
*/