Pre-release
AdventureJS Docs Downloads Bundler Devlog Score: 0 Moves: 0
// onUnnestThatFromThis.js
(function () {
  /* global AdventureJS A */
  var p = AdventureJS.Assets.Entity.prototype;
  /**
   * Called when subject is unnested from this asset.
   * Provides an opportunity to override default behavior
   * through the use of
   * <a href="/doc/BasicVerbs_ReactionHooks.html">verb reactions</a>
   * doUnnestThatFromThis.
   * @memberOf AdventureJS.Assets.Entity
   * @method AdventureJS.Assets.Entity#onUnnestThatFromThis
   * @param {Object} subject
   * @returns {Boolean}
   */
  p.onUnnestThatFromThis = function Entity_onUnnestThatFromThis(subject) {
    if ("string" === typeof subject) subject = this.game.getAsset(subject);
    if (!subject) return;
    this.game.log(
      "L1481",
      "log",
      "high",
      `onUnnestThatFromThis.js | unnest ${subject.id} from ${this.id}`,
      "Entity"
    );
    var results;

    if (this.isDOV("ride") && this.isWithin(subject)) {
      results = subject.onMoveThatFromThis(this);
      if ("undefined" !== typeof results) return results;
    }

    results = this.doVerbAction({
      action: "doUnnestThatFromThis",
      target: subject,
      type: "VerbReaction",
    });
    if ("undefined" !== typeof results) return results;

    if (subject.id === this.game.world._player) {
      results = this.doVerbAction({
        action: "doPlayerExit",
        target: subject,
        params: {},
        type: "VerbReaction",
      });
      if ("undefined" !== typeof results) return results;
    }

    return;
  };
})();