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

  /**
   * @ajspath AdventureJS.Atom.TraitManager.Asset_Is.Tangible_Is.SubstanceEmitter_Is
   * @augments AdventureJS.AssetTraits.Tangible_Is
   * @class AdventureJS.AssetTraits.SubstanceEmitter_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
   * <p>
   * <strong>SubstanceEmitter_Is.js</strong> handles is.state management for
   * {@link AdventureJS.Assets.SubstanceEmitter|SubstanceEmitter Assets}.
   **/

  class SubstanceEmitter_Is extends AdventureJS.AssetTraits.Tangible_Is {
    constructor(name = "is", game_name, context_id) {
      // Call the constructor of the super class
      super(name, game_name, context_id);
      this.class = "SubstanceEmitter_Is";
      this._on = false;
      return this;
    }

    /**
     * <code>on</code> indicates whether the object is turned on
     * via the turnOn verb. The SubstanceEmitter class handles
     * on/off distinctly from other classes, because on/off is
     * determined by whether it is emitting.
     * Unavailable during asset construction, as context
     * won't have been defined yet.
     * @var {Boolean} AdventureJS.Assets.SubstanceEmitter#is!on
     * @default false
     */
    get on() {
      return this.context.aspects.in.vessel.is.emitting;
    }
    set on(value) {
      // can't be set
    }

    /**
     * Shortcut to tangible.aspects.in.vessel.is.emitting.
     * Unavailable during asset construction, as context
     * won't have been defined yet.
     * @var {Getter/Setter} AdventureJS.Assets.SubstanceEmitter#is!emitting
     */
    get emitting() {
      return this.context.aspects.in.vessel.is.emitting;
    }
    set emitting(value) {
      this.context.aspects.in.vessel.is.emitting = value;
    }
  }
  AdventureJS.AssetTraits.SubstanceEmitter_Is = SubstanceEmitter_Is;
})();