// onActivate.js
(function () {
/* global adventurejs A */
var p = adventurejs.Tangible.prototype;
/**
* Called when an asset is activated as a result of verb
* <code>turnOn</code> or by other verbs or circumstances.
* Provides an opportunity to override default behavior
* through the use of the <code>doActivate</code>
* <a href="/doc/Verbs_ReactionHooks.html">verb reaction</a>.
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#onActivate
* @param {Object} asset
* @param {String} where
* @returns {*}
*/
p.onActivate = function Tangible_onActivate(asset) {
if ("string" === typeof asset) asset = this.game.getAsset(asset);
if (!asset) return;
this.game.log(
"L1579",
"log",
"high",
`[onActivate.js] activate ${this.id}`,
"Tangible"
);
var results;
// check receiving asset for verb hook
results = this.doVerbAction({
action: "doActivate",
type: "VerbReaction",
});
if ("undefined" !== typeof results) return results;
// state change
this.is.active = true;
}; // onActivate.js
})();