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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Container.LiquidContainer.Drainable.Bathtub
   * @augments adventurejs.Drainable
   * @class adventurejs.Bathtub
   * @ajsconstruct MyGame.createAsset({ "class":"Bathtub", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading BathroomClasses
   * @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.
   * @ajsparts Faucet, GraduatedController, Drain, Plug
   * @summary Rub a dub dub.
   * @tutorial Substances_Vessels
   * @tutorial Tangibles_LinkedAssets
   * @tutorial Tangibles_Collections
   * @classdesc
   * <p>
   * <strong>Bathtub</strong> is a subclass of
   * {@link adventurejs.Drainable|Drainable}.
   * A Bathtub can be linked with a
   * {@link adventurejs.Faucet|Faucet} and
   * {@link adventurejs.FaucetHandle|Handles} and a
   * {@link adventurejs.Drain|Drain} and
   * {@link adventurejs.Plug|Plug}
   * through the use of the
   * <code class="property">{@link adventurejs.Tangible#parts|parts}</code>
   * property.
   * </p>
   * <p>
   * Note that <code class="property">parts</code>
   * is a special convenience property that only pertains to some
   * {@link adventurejs.Asset|Asset} classes with inherent code
   * for linking certain other Asset classes.
   * To learn more about which classes can be linked through the
   * <code class="property">parts</code> property, see <a href="/doc/Tangibles_LinkedAssets.html">Linked Assets</a>.
   * </p>
   * <p>
   * Following is an example of a Bathtub with
   * Handles, a Drain and Plug, and a Faucet.
   * </p>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Bathtub",
   *   name: "bathtub",
   *   place: { in: "Standing Room" },
   *   descriptions: {
   *     look: function()
   *     {
   *       return "A clawfoot tub with porcelain handles
   *       and a stainless steel faucet. Its drain appears to
   *       be $( bathtub drain is| open or| closed ). ";
   *       // see <a href="/doc/Scripting_CustomTemplates.html">Custom Templates</a>
   *     },
   *   },
   *   in: {
   *     vessel: {
   *       drain_id: "bathtub drain",
   *     }
   *   },
   *   parts: [
   *     "hot water handle",
   *     "cold water handle",
   *     "faucet",
   *     "drain",
   *     "plug"
   *   ],
   * });
   *
   * MyGame.createAsset({
   *   class: "Drain", // see {@link adventurejs.Drain|Drain} class
   *   name: "bathtub drain",
   *   synonyms: "bathtub drain",
   *   is: { open: true, },
   *   dov: { open: true, close: true, },
   *   descriptions: {
   *     look: function()
   *     {
   *       return "A dark drain. Currently
   *       $( bathtub drain is| open or| closed ). "
   *     },
   *   },
   * });
   *
   * MyGame.createAsset({
   *   class: "Faucet", // see {@link adventurejs.Faucet|Faucet} class
   *   name: "faucet",
   *   descriptions: { look: "The bathtub faucet. ", },
   *   substance_id: "water",
   *   max_volume_of_flow_per_turn: 1000,
   * });
   *
   * MyGame.createAsset({
   *   class: "FaucetHandle", // see {@link adventurejs.FaucetHandle|FaucetHandle} class
   *   name: "hot water handle",
   *   synonyms: [ "handle", "bathtub handle" ],
   *   adjectives: [ "hot water", "bathtub", "porcelain" ],
   *   descriptions: { look: "The bathtub's hot water handle. ", },
   *   set_substance_id: "hot water",
   *   set_substance_temperature: 70
   * });
   *
   * MyGame.createAsset({
   *   class: "FaucetHandle",
   *   name: "cold water handle",
   *   descriptions: { look: "The bathtub's cold water handle. ", },
   *   set_substance_id: "cold water",
   *   set_substance_temperature: 20
   * });
   *
   * MyGame.createAsset({
   *   class: "Collection", // see {@link adventurejs.Collection|Collection} class
   *   name: "bathtub handles",
   *   synonyms: [ "porcelain handles" ],
   *   place: { attached: "bathtub" },
   *   collection: [ "hot water handle", "cold water handle"],
   *   is: { listed_in_parent: false },
   *   descriptions: { look: "Two porcelain bathtub handles, hot and cold. ", },
   * });
   *
   * MyGame.createAsset({
   *   class: "Plug",
   *   name: "bathtub plug",
   *   synonyms: "plug",
   *   place: { in: "bathtub" },
   *   descriptions: { look: "A bathtub drain plug. ", },
   * });
   * </code></pre>
   * <p>
   * The above example uses $(string) substitutions to
   * create a dynamic description. To learn more, see
   * <a href="/doc/Scripting_CustomTemplates.html">Custom Templates</a>.
   * </p>
   *
   * **/
  class Bathtub extends adventurejs.Drainable {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Bathtub";

      this.noun = "bathtub";
      this.plural = "bathtubs";
      this.synonyms = ["tub"];
      this.singlePluralPairs = [["bathtub", "bathtubs"]];

      this.setIOVs(["fill", "empty", "drink", "pour"]);
      this.setDOVs(["fill", "empty"]);

      this.default_aspect = "in";

      this.can.jump_in = true;

      // this.aspects.attached.set({
      // });

      this.aspects.in.set({
        list_in_examine: true,
        list_in_room: false,
        maxheight: 2,
        maxwidth: 6,
        maxdepth: 2,
        maxcount: 10,
        maxsize: 2,
        maxweight: 100,

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

      this.aspects.in.vessel.set({
        maxvolume: "200L",
      });
    }
  }
  adventurejs.Bathtub = Bathtub;
})();