Pre-release
AdventureJS Docs Downloads Bundler Devlog
Score: 0 Moves: 0
// onMoveThatToThis.js
(function () {
  /* global AdventureJS A */
  var p = AdventureJS.Assets.Entity.prototype;
  /**
   * Called when another asset is added to this.
   * Provides opportunities to override default behavior
   * through the use of
   * <a href="/doc/Verbs_ReactionHooks.html">verb reactions</a>
   * doMoveThisToThat and doMoveThatToThis.
   * @memberOf AdventureJS.Assets.Entity
   * @method AdventureJS.Assets.Entity#onMoveThatToThis
   * @param {Object} asset
   * @param {String} where
   * @returns {*}
   */
  p.onMoveThatToThis = function Entity_onMoveThatToThis(
    aspect,
    asset,
    quantity = 1
  ) {
    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}`,
      "Entity"
    );
    var results;

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

    let destroyed = asset.is.destroyed;

    // check receiving asset for verb hook
    results = this.doVerbAction({
      action: "doMoveThatToThis",
      target: asset,
      params: {
        preposition: aspect,
      },
      type: "VerbReaction",
    });
    if ("undefined" !== typeof results) return results;

    if (!destroyed && asset.is.destroyed) return;

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