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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Furniture.Chair
   * @augments adventurejs.Furniture
   * @class adventurejs.Chair
   * @classdesc Plain text description. Explanation of the class.
   * @ajsconstruct MyGame.createAsset({ "class":"Chair", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading FurnitureClasses
   * @param {String} game_name The name of the top level game object.
   * @param {String} name A name for the object, to be serialized and used as ID.
   * @summary For sitting.
   * @tutorial Tangibles_AboutTangibles
   * @ajstangiblecontainer on
   * @ajstangiblecontainer under
   * @classdesc <strong>Chair</strong> is child class of
   * {@link adventurejs.Furniture|Furniture}. Player can sit on it, sit in it,
   * put things on it, etc. By default, chairs are set so that
   * "sit in" and "sit on" are interchangeable, via the
   * <a href="#quirks.in_means_on">quirks.in_means_on</a>
   * property.
   **/
  class Chair extends adventurejs.Furniture {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Chair";

      this.noun = "chair";
      this.plural = "chairs";
      this.singlePluralPairs = [["chair", "chairs"]];

      this.setDOVs(["move", "push"]);
      this.can.push_from_room = true;
      this.can.turn = true;
      this.quirks.stand_means_get_off = true;
      this.quirks.get_up_means_get_off = true;
      this.quirks.in_means_on = true;

      this.default_aspect = "on";

      this.aspects.under = new adventurejs.Aspect("under", this.game_name).set({
        parent_id: this.id,
        list_in_room: false,
        maxheight: 1,
        maxwidth: 6,
        maxdepth: 3,
        maxcount: 10,
        maxsize: 10,
        maxweight: 100,
      });

      this.aspects.on.set({
        list_in_room: false,
        maxheight: 1,
        maxwidth: 1,
        maxdepth: 1,
        maxcount: 10,
        maxsize: 2,
        maxweight: 100,
        player: {
          posture: "sit",
          preposition: "on",
          can: { sit: true, stand: true, enter: true },
        },
      });
    }
  }
  adventurejs.Chair = Chair;
})();