Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// Tangible_Is.js
(function () {
  /*global adventurejs A*/
  "use strict";

  /**
   * @ajspath adventurejs.Atom.StateManager.Asset_Is.Tangible_Is
   * @augments adventurejs.Asset_Is
   * @class adventurejs.Tangible_Is
   * @ajsnavheading StateClasses
   * @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>Tangible_Is.js</strong> is a state management class
   * used to handle a variety of properties for
   * {@link adventurejs.Tangible|Tangible Assets}.
   **/

  class Tangible_Is extends adventurejs.Asset_Is {
    constructor(name = "is", game_name, parent_id) {
      // Call the constructor of the parent class
      super(name, game_name, parent_id);

      this.class = "Tangible_Is";
      this._seen = false;
      //this._known = false;

      /**
       * Set whether this asset is plugged, like a drain.
       * @var {Boolean} adventurejs.Asset#is!plugged
       * @default false
       */
      this._plugged = false;

      /**
       * Set whether this asset is plugged in, like an appliance.
       * @var {Boolean} adventurejs.Asset#is!pluggedIn
       * @default false
       */
      this._pluggedIn = false;

      /**
       * Set whether this asset is hidden.
       * @var {Getter|Boolean} adventurejs.Tangible#is!hidden
       * @default false
       * @todo add logic to test conditions?
       */
      this.hidden = false;

      /**
       * Set whether this asset is a typing target, as in a screen for a keyboard.
       * @var {Boolean} adventurejs.Tangible#is!typing_target
       * @default false
       */
      this.typing_target = false;

      /**
       * Set whether this asset is supported. Used in conjuction with
       * can.swing_on_if_holding_and_supported to determine whether player can swing
       * on the asset in its current state. Meant for assets like two-ended ropes
       * which must be tied to a supporting structure.
       * @var {Boolean} adventurejs.Tangible#is!supported
       * @default false
       */
      this.supported = false;

      /**
       * Set whether this asset is hollow. Used to determine whether player can look in asset.
       * @var {Boolean} adventurejs.Tangible#is!hollow
       * @default false
       */
      this.hollow = false; // determines whether you can look in

      /**
       * Set whether this asset is listed in the current room description.
       * @var {Boolean} adventurejs.Tangible#is!listed_in_room
       * @default true
       */
      this.listed_in_room = true;

      /**
       * Set whether this asset's children are listed in the current room description.
       * Meant for situations where a parent asset is part of the room description,
       * to avoid listing the parent asset twice.
       * @var {Boolean} adventurejs.Tangible#is!unlisted_but_list_children
       * @default false
       */
      this.unlisted_but_list_children = false;

      /**
       * Set whether this asset is listed in its parent's description.
       * @var {Boolean} adventurejs.Tangible#is!listed_in_parent
       * @default true
       */
      this.listed_in_parent = true;

      /**
       * Set whether this asset is distant. Originally meant to help define scenery assets,
       * but mostly superseded by other scenery handling and no logic has been written for it.
       * @var {Boolean} adventurejs.Tangible#is!distant
       * @default false
       */
      this.distant = false;

      /**
       * Set whether this asset is watertight.
       * No logic has been written for this.
       * @var {Boolean} adventurejs.Tangible#is!watertight
       * @default false
       * @todo Write logic for this. Is this the same as airtight?
       */
      this.watertight = false;

      /**
       * Set whether this asset is being worn by player or other characters.
       * @var {Boolean} adventurejs.Tangible#is!worn
       * @default false
       */
      this.worn = false;

      /**
       * Set whether this asset is screwed.
       * @var {Boolean} adventurejs.Tangible#is!screwed
       * @default false
       */
      this.screwed = false;

      /**
       * Set whether this asset is zipped.
       * @var {Boolean} adventurejs.Tangible#is!zipped
       * @default false
       */
      this.zipped = false;

      /**
       * Set whether this asset is buttoned.
       * @var {Boolean} adventurejs.Tangible#is!buttoned
       * @default false
       */
      this.buttoned = false;

      /**
       * Set whether this asset is fixed in its place, such as drawers in a desk.
       * (This may be redundant to can_be_taken.)
       * @var {Boolean} adventurejs.Tangible#is!fixed
       * @default false
       */
      this.fixed = false;

      /**
       * Set whether this asset is locked.
       * @var {Boolean} adventurejs.Tangible#is!locked
       * @default false
       */
      this._locked = false;

      /**
       * Set whether this asset is closed.
       * @var {Boolean} adventurejs.Tangible#is!closed
       * @default false
       */
      this._closed = false;

      /**
       * Set whether this asset is sealed.
       * @var {Boolean} adventurejs.Tangible#is!sealed
       * @default false
       */
      this._sealed = false;

      /**
       * Set whether player can leave this asset. Useful for keeping player from leaving,
       * such as if they're on a carousel horse while the carousel is in motion.
       * @nestedproprty
       * @var {Boolean} adventurejs.Tangible#is!unleavable
       * @default false
       */
      this.unleavable = false;

      /**
       * Set whether this asset can be climbed.
       * @var {Boolean} adventurejs.Tangible#is!climbable
       * @default false
       */
      this.climbable = false;

      /**
       * Set whether this asset can be peddled, like a bicycle.
       * @var {Boolean} adventurejs.Tangible#is!peddleable
       * @default false
       */
      this.peddleable = false;

      /**
       * Set whether this asset can be skated on, like a skateboard.
       * @var {Boolean} adventurejs.Tangible#is!skateable
       * @default false
       */
      this.skateable = false;

      /**
       * Set whether this asset can be looked through,
       * like a window or a telescope.
       * @var {Boolean} adventurejs.Tangible#is!lookthroughable
       * @default false
       */
      this.lookthroughable = false;

      /**
       * Set whether player can nest inside this asset when this asset is in an
       * aspect of another asset (as opposed to being a direct child of a room).
       * For example, a carousel horse might be on a carousel platform.
       * @var {Boolean} adventurejs.Tangible#is!deep_nest
       * @default false
       */
      this.deep_nest = false;

      /**
       *
       * @var {Boolean} adventurejs.Tangible#is!false_nest
       * @default false
       */
      this.false_nest = false;

      return this;
    }

    get seen() {
      return this._seen;
    }
    set seen(value) {
      this._seen = value;
      //this.setLinkedAssetState("_seen", value);
      let parent = this.parent;
      if (parent && parent.setAllAspectsContentsSeen)
        parent.setAllAspectsContentsSeen.call(parent, value);
    }

    get known() {
      return this._known;
    }
    set known(value) {
      this._known = value;
      //this.setLinkedAssetState("_known", value);
      let parent = this.parent;
      if (parent && parent.setAllAspectsContentsKnown)
        parent.setAllAspectsContentsKnown.call(parent, value);
    }

    get plugged() {
      return this._plugged;
    }
    set plugged(value) {
      this._plugged = value;
    }

    get pluggedIn() {
      return this._pluggedIn;
    }
    set pluggedIn(value) {
      this._pluggedIn = value;
    }

    get sealed() {
      return this._sealed;
    }
    set sealed(value) {
      this._sealed = value;
    }

    get closed() {
      return this._closed;
    }
    set closed(value) {
      this._closed = value;
    }

    get locked() {
      return this._locked;
    }
    set locked(value) {
      this._locked = value;
    }
  }
  adventurejs.Tangible_Is = Tangible_Is;
})();