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

    //
    if ("string" !== typeof aspect) {
      aspect = this.default_aspect;
    }

    // check receiving asset for verb hook
    results = this.callAction("doMoveThatToThis", asset.name, null, {
      preposition: aspect,
    });
    if ("undefined" !== typeof results) return results;

    // check asset to be placed for verb hook
    //console.warn(asset);
    results = asset.callAction("doMoveThisToThat", this.name);
    if ("undefined" !== typeof results) return results;

    // set asset's new location to this
    asset.setPlace(aspect, this.id);

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