/** * @class BehaviorConstructor * @memberof jibo.bt * @description Abstract type alias (needed by the Factory function) for the constructors of the behavior and decorator classes. */ /** * Utility methods for registering behaviors and creating behaviors trees. * @namespace jibo.bt */ /** * Map of behaviors * @name jibo.bt#_behaviors * @type {Object} * @private */ /** * The default blackboard * @name jibo.bt#blackboard * @type {jibo.bt.Blackboard} * @private */ /** * Register a behavior or decorator globally * @name jibo.bt#register * @method * @param {String} name The PascalCased name for the behavior * @param {String} namespace This behavior's namespace. Pass in a globally unique name for this namesapce. * @param {Module} classRef Class reference for the behavior or decorator */ /** * Add all behaviors * @method jibo.bt#registerCore * @private */ /** * Creates a runnable behavior tree from a bt file import. * @method jibo.bt#create * @param {String|Function} uri Relative or absolute path to a `.bt` file or module export of behavior tree. * @param {Object} [overrides] Options for populating behavior tree globals. * @param {jibo.bt.Blackboard} [overrides.blackboard] Override the default blackboard object for this behavior tree. * @param {Object} [overrides.notepad] Provide your own notepad object instead of the default one. * @param {String} [overrides.assetPack] The asset pack name to use for loading assets in this tree. * @returns {jibo.bt.BehaviorTree} */ /** * Creates and runs a runnable behavior tree from a bt file import. * ``` * const jibo = require('jibo'); * jibo.init('face', (err) => { * jibo.bt.run('./behaviors/main', function(status){}); * }); * * // Other supported APIs * jibo.bt.run('./behaviors/main'); * jibo.bt.run('./behaviors/main', (status) => {}); * const overrides = {}; * jibo.bt.run('./behaviors/main', overrides); * jibo.bt.run('./behaviors/main', overrides, (status) => {}); * ``` * * @method jibo.bt#run * @param {String|Function} uri Relative or absolute path to a `.bt` file or module export of behavior tree. * @param {Object} [overrides] Options for populating behavior tree globals. * @param {jibo.bt.Blackboard} [overrides.blackboard] Override the default blackboard object for this behavior tree. * @param {Object} [overrides.notepad] Provide your own notepad object instead of the default one. * @param {String} [overrides.assetPack] The asset pack name to use for loading assets in this tree. * @param {Function} onFinishedCallback The callback which gets called when the behavior tree has reached a status of FAILED, SUCCEEDED, or INTERRUPTED. * @param {Status} status The status which the behavior tree finished with. * @returns {jibo.bt.BehaviorTree} */ /** * Resolves the path in relation to a calleeDirname directory. If the supplied uri is an absolute path, the uri is * returned unmodified * @param {String} calleeDirname The directory name where the uri is relative to * @param {String} uri The relative or absolute uri to a file in relation to the calleeDirname * @returns {String} The result absolute path * */