Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// hasListableContents.js
(function () {
  /*global adventurejs A*/
  "use strict";
  var p = adventurejs.Tangible.prototype;
  /**
   * Check whether this asset has any listable contents.
   * @memberOf adventurejs.Tangible
   * @method adventurejs.Tangible#hasListableContents
   * @returns {Boolean}
   * @TODO transparent containers
   */
  p.hasListableContents = function Tangible_hasListableContents() {
    for (var i = 0; i < this.game.dictionary.prepositions.length; i++) {
      var aspect = this.game.dictionary.prepositions[i];
      if (!this.hasAspectAt(aspect)) {
        continue;
      }
      if (
        this.aspects[aspect].list_in_room &&
        this.aspects[aspect].contents.length > 0
      ) {
        if (aspect === "in" && true === this.is.closed) continue;
        // @TODO transparent containers
        return true;
      }
    }

    return false;
  };
})();