Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 1
// setAspectContentsSeen.js
(function () {
  /*global adventurejs A*/
  var p = adventurejs.Tangible.prototype;
  /**
   * When player sees an asset, call this function to
   * make its contents known. Generally, contents of
   * behind/in/on/under are listed automatically and seen,
   * whereas attachments may go unlisted in room descriptions.
   * This function is chiefly for setting is.seen
   * for attachments, but can be applied to any aspects.
   * @memberOf adventurejs.Tangible
   * @method adventurejs.Tangible#setAspectContentsSeen
   */
  p.setAspectContentsSeen = function Tangible_setAspectContentsSeen(
    aspect,
    value
  ) {
    //console.warn(this.id, "setAspectContentsSeen", aspect, value);
    if ("undefined" === typeof value) return false;
    if (!this.hasAspectAt(aspect)) {
      this.game.log(
        "L1456",
        "warn",
        "high",
        "setAspectContentsSeen.js > Bad request",
        "Tangible"
      );
      return false;
    }
    const subject = this.game.getSubject();
    var contents = this.aspects[aspect].contents;
    for (var i = 0; i < contents.length; i++) {
      var object = this.game.getAsset(contents[i]);
      subject.see(object);
    }
    return;
  };
})();