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

  /**
   * @ajspartof Sink
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.SubstanceEmitter.Faucet
   * @augments adventurejs.SubstanceEmitter
   * @class adventurejs.Faucet
   * @ajsconstruct MyGame.createAsset({ "class":"Faucet", "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.
   * @summary Faucet is a SubstanceEmitter that can generate liquid.
   * @tutorial Substances_Emitters
   * @classdesc
   * <p>
   * <strong>Faucet</strong> is a subclass of
   * {@link adventurejs.SubstanceEmitter|SubstanceEmitter}.
   * When it's turned on, water (or other specified
   * {@link adventurejs.Substance|Substance})
   * will emit from it. A Faucet can be linked with a
   * {@link adventurejs.Sink|Sink} or
   * {@link adventurejs.Bathtub|Bathtub} or other
   * {@link adventurejs.Vessel|Vessel}
   * such that the Faucet pours into the basin. A Faucet
   * can also stand on its own, as with an outdoor hose bib,
   * and be allowed to pour onto the ground. By itself, a Faucet
   * has no controls. Pair it with a
   * {@link adventurejs.Handle|Handle}
   * to control its rate of flow.
   * Use a Faucet's
   * <code class="property">rate_of_flow</code> and
   * <code class="property">max_volume_of_flow_per_turn</code> properties to
   * set how much volume of substance will be generated per turn.
   * See the {@link adventurejs.Sink|Sink} page for an example
   * that includes a Sink with linked Faucet and Handle.
   * </p>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Faucet",
   *   name: "hose bib",
   *   synonyms: [ "bib" ],
   *   descriptions: { look: "A hose bib . ", },
   *   substance_id: "water",
   *   max_volume_of_flow_per_turn: 1000,
   *   place: { attached: "garden wall" },
   * });
   * </code></pre>
   * <p>
   * To learn more, see
   * <a href="/doc/Substances_AboutSubstances.html">Substances</a>.
   * </p>
   * @todo registerParts faucet+handle(s) without sink.
   **/
  class Faucet extends adventurejs.SubstanceEmitter {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Faucet";

      this.singlePluralPairs = [["faucet", "faucets"]];

      this.descriptions.look = "It's a faucet.";

      this.is.listed_in_parent = false;

      this.dimensions.width = 1;
      this.dimensions.height = 1;

      //this.max_volume_of_flow_per_turn = 500;
      this.aspects.in.vessel.max_volume_of_flow_per_turn = 500;

      this.setDOVs(["turn", "drink"]);

      this.unsetDOVs(["give", "take"]);
    }
  }
  adventurejs.Faucet = Faucet;
})();