Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// placePreventsNesting.js
(function () {
  /*global adventurejs A*/
  var p = adventurejs.Tangible.prototype;
  /**
   * Check whether the specified asset can be nested to this while
   * this is in its current location.
   * @memberOf adventurejs.Tangible
   * @method adventurejs.Tangible#placePreventsNesting
   * @param {Object} player
   * @returns {Boolean}
   */
  p.placePreventsNesting = function Tangible_placePreventsNesting(player) {
    if ("string" === typeof player) player = this.game.getAsset(player);
    if (!player) return;
    this.game.log(
      "L1486",
      "log",
      "low",
      `placePreventsNesting.js > nest ${player.id} to ${this.id}`,
      "tangible"
    );

    return (
      this.getPlaceAssetId() !== player.id &&
      !(this.getPlaceAsset() instanceof adventurejs.Room) &&
      !this.is.deep_nest
    );
  };
})();