Adds a behavior to the behavior class instance.
Note
Does not check for inconsistencies within ID and index arrays, as if it is internally managed by this class, inconsistencies should not happen.
Usage
// Create a new instance of Behavior
var behavior = new Behavior();
// Add a behavior
behavior.addBehavior("hello_behavior", () => console.log("Hello World"));
Name of the bahavior
Behavior callback function
ID of the behavior; behaviorCreationError
if creation failed
Adds behaviors to the system, and fires post-addtion events. Firstly, this function attempts to add the behaviors. When the behavior addition has been processed, the function will attempt to fire post-addition events, depending on success/failure of behavior additions.
Triggers behaviors registered for name.
Usage
// Create a new instance of Behavior
var behavior = new Behavior();
// Add a behavior
behavior.addBehavior("hello_behavior", () => console.log("Hello World"));
// Call a behavior
behavior.behave("hello_behavior");
// Output:
// "Hello World"
Behavior name
Fires a system event
Event name, as specified in {@link module:system.private#events}.
Message is not strictly required, but preferred. If not specified, will assume value of the name
// TODO: @event module:system.private#events#eventFail
// TODO: Throws {external:Error} Will throw error_hell
. The inability to process error - if {@link module:system.private#events#event:eventFail} event fails.
Usage
var options = {
id: "lab_inventory",
rootDir: "labs",
relativeInitDir: "black_mesa",
initFilename: "inventory.yml",
logging: "console"
};
var labInventory = new System(options);
labInventory.fire("system_load_aux", "Auxiliary system loaded.");
Generated using TypeDoc
Behavior creation error, returned by [[Behavior.addBehavior]].