Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// onUnnestThisFromThat.js
(function () {
  /* global adventurejs A */
  var p = adventurejs.Character.prototype;
  /**
   * Called when player is unnested from another asset.
   * Provides an opportunity to override default behavior
   * through the use of
   * <a href="/doc/Scripting_VerbReactions.html">verb reactions</a>
   * doUnnestThisFromThat and doUnnestThatFromThis.
   * @memberOf adventurejs.Character
   * @method adventurejs.Character#onUnnestThisFromThat
   * @param {Object} asset
   * @returns {Boolean}
   */
  p.onUnnestThisFromThat = function Character_unnestThisFromThat(asset) {
    this.game.log(
      "L1432",
      "log",
      "high",
      `[onUnnestThisFromThat.js] unnest ${this.id} from ${asset.id}`,
      "Character"
    );
    if (!asset) return;
    var results;

    results = this.doVerbAction({
      action: "doUnnestThisFromThat",
      asset2: asset.name,
      type: "VerbReaction",
    });
    if ("undefined" !== typeof results) return results;

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

    this.unsetNest();
    this.posture = this.getPlaceAspect().nest.posture;

    return;
  };
})();