Pre-release
AdventureJS Docs Downloads Bundler Devlog
Score: 0 Moves: 0
// Room_Is.js
(function () {
  /* global AdventureJS A */

  /**
   * @ajspath AdventureJS.Atom.TraitManager.Asset_Is.Entity_Is.Room_Is
   * @augments AdventureJS.Traits.Entity_Is
   * @class AdventureJS.Traits.Room_Is
   * @ajsnavheading TraitClasses
   * @param {String} game_name Name of top level game instance that is scoped to window.
   * @param {String} name Instance name.
   * @summary A container for state variables.
   * @classdesc
   * <strong>Room_Is.js</strong> is a state management class
   * used to handle a variety of properties for
   * {@link AdventureJS.Assets.Room|Room Assets}.
   **/

  class Room_Is extends AdventureJS.Traits.Entity_Is {
    constructor(name = "is", game_name, context_id) {
      // Call the constructor of the super class
      super(name, game_name, context_id);
      this.class = "Room_Is";

      return this;
    }

    /**
     * Get whether room is dark.
     * @var {Boolean} AdventureJS.Assets.Room#is!dark
     */
    set dark(value) {
      this._dark = value;
    }
    get dark() {
      // let dark_sources = this.context.dark_sources;
      // if (dark_sources.length) return true;

      // // check for light sources
      // let light_sources = this.context.light_sources;
      // // @TODO check for light sources enclosed in opaque containers
      // if (light_sources.length) return false;

      // otherwise
      return this._dark;
    }
  }
  AdventureJS.Traits.Room_Is = Room_Is;
})();