Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// onRemoveThatFromThis.js
(function () {
  /*global adventurejs A*/
  "use strict";
  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) {
    this.game.log(
      "log",
      "high",
      this.name + " onRemoveThatFromThis " + asset.name + ".",
      "Behavior"
    );
    var results;

    this.game.debug(
      `F1149 | onRemoveThatFromThis.js | remove ${asset.id} from ${this.id} `
    );

    // this may have an override when asset is removed
    results = this.callAction("doRemoveThatFromThis", asset.name, {});
    if (A.isFalseOrNull(results)) return results;

    // asset may also have an ovveride when removed from this
    results = asset.callAction("doRemoveThisFromThat", this.name, {});
    if (A.isFalseOrNull(results)) return results;

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

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