// onTryRemoveThatFromThis.js
(function () {
/* global adventurejs A */
var p = adventurejs.Tangible.prototype;
/**
* Called when an attempt is made to remove another asset from this.
* Provides opportunities to override default behavior
* through the use of
* <a href="/doc/Verbs_ReactionHooks.html">verb reactions</a>
* tryRemoveThisFromThat and onTryRemoveThatFromThis.
* @memberOf adventurejs.Tangible
* @method adventurejs.Tangible#onTryRemoveThatFromThis
* @param {Object} asset
* @returns {Boolean}
*/
p.onTryRemoveThatFromThis = function Tangible_onTryRemoveThatFromThis(asset) {
if ("string" === typeof asset) asset = this.game.getAsset(asset);
if (!asset) return;
this.game.log(
"L1485",
"log",
"high",
`[onTryRemoveThatFromThis.js] remove ${asset.id} from ${this.id}`,
"Tangible"
);
var results;
// this may have an override when asset is removed
results = this.doVerbAction({
action: "tryRemoveThatFromThis",
asset2: asset.name,
type: "VerbReaction",
});
if ("undefined" !== typeof results) return results;
// asset may also have an ovveride when removed from this
results = asset.doVerbAction({
action: "tryRemoveThisFromThat",
asset2: this.name,
type: "VerbReaction",
});
if ("undefined" !== typeof results) return results;
return; // results;
};
})(); // onTryRemoveThatFromThis.js