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

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

    this.game.debug(
      `F1930 | onMoveThatToThis.js | move ${asset.id} ${aspect} ${this.id} `
    );

    // check receiving asset for verb hook
    results = this.callAction("doMoveThatToThis", asset.name, {
      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, null);
    if ("undefined" !== typeof results) return results;

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

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