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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Furniture.Tub
   * @augments adventurejs.Furniture
   * @class adventurejs.Tub
   * @ajsconstruct MyGame.createAsset({ "class":"Tub", "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 A non-interactive tub.
   * @tutorial Tangibles_AboutTangibles
   * @ajstangiblecontainer in
   * @ajstangiblecontainer attached
   * @classdesc <strong>Tub</strong> is child class of
   * {@link adventurejs.Furniture|Furniture}.
   * This is a simple version of a tub. Players can get in
   * it and pour water in it, but it doesn't have a faucet
   * or drain. For a more interactive version with linked
   * faucet/handles/drain, see
   * {@link adventurejs.Bathtub|Bathtub}.
   **/
  class Tub extends adventurejs.Furniture {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Tub";

      this.noun = "tub";
      this.plural = "tubs";
      this.singlePluralPairs = [["tub", "tubs"]];

      this.setDOVs(["fill", "empty"]);
      this.setIOVs(["fill", "empty", "drink", "pour"]);
      this.can.be_filled_from = true;
      this.can.be_poured_into = true;

      this.default_aspect = "in";
      this.aspects.in = new adventurejs.Aspect("in", this.game_name).set({
        parent_id: this.id,
        list_in_examine: true,
        list_in_room: false,
        maxheight: 2,
        maxwidth: 6,
        maxdepth: 2,
        maxcount: 10,
        maxsize: 2,
        maxweight: 100,

        player: {
          posture: "stand",
          preposition: "in",
          can: {
            enter: true,
            sit: true,
            kneel: true,
            hide: true,
            lie: true,
            stand: true,
          },
        },
      });

      this.aspects.in.vessel = new adventurejs.Vessel("in", game_name).set({
        parent_id: this.id,
        maxvolume: "200L",
      });

      this.aspects.attached = new adventurejs.Aspect(
        "attached",
        this.game_name
      ).set({
        parent_id: this.id,
        list_in_room: false,
        list_in_examine: false,
        player_can_add_assets_to_contents: false,
        player_can_remove_assets_from_contents: false,
      });
    }
  }
  adventurejs.Tub = Tub;
})();