Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// onRemoveThatFromThis.js
(function () {
  /*global adventurejs A*/
  var p = adventurejs.Tangible.prototype;
  /**
   * Called when another asset is removed from this.
   * Provides opportunities to override default behavior
   * through the use of
   * <a href="/doc/Scripting_VerbReactions.html">verb reactions</a>
   * doRemoveThisFromThat and doRemoveThatFromThis.
   * @memberOf adventurejs.Tangible
   * @method adventurejs.Tangible#onRemoveThatFromThis
   * @param {Object} asset
   * @returns {Boolean}
   */
  p.onRemoveThatFromThis = function Tangible_onRemoveThatFromThis(asset) {
    if ("string" === typeof asset) asset = this.game.getAsset(asset);
    if (!asset) return;
    this.game.log(
      "L1485",
      "log",
      "high",
      `onRemoveThatFromThis.js > remove ${asset.id} from ${this.id} `,
      "VerbActions"
    );
    var results;

    // this may have an override when asset is removed
    results = this.callAction("doRemoveThatFromThis", asset.name);
    if ("undefined" !== typeof results) return results;

    // asset may also have an ovveride when removed from this
    results = asset.callAction("doRemoveThisFromThat", this.name);
    if ("undefined" !== typeof results) return results;

    // bedrock - perform the removal - no overrides or qualifiers
    this.removeThatFromThis(asset);
    asset.setPlace();

    return; // results;
  };
})(); // onRemoveThatFromThis.js