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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Container.LiquidContainer.Drainable.Sink
   * @augments adventurejs.Drainable
   * @class adventurejs.Sink
   * @classdesc Explanation of the class.
   * @ajsconstruct MyGame.createAsset({ "class":"Sink", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading MiscAssetClasses
   * @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 For bathrooms and kitchens.
   * @classdesc
   * <p>
   * <strong>Sink</strong> is a subclass of
   * {@link adventurejs.Drainable|Drainable}.
   * A Sink 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 methods
   * 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 Sink with a
   * {@link adventurejs.Faucet|Faucet},
   * {@link adventurejs.FaucetHandle|Handles}, a
   * {@link adventurejs.Drain|Drain} and
   * {@link adventurejs.Plug|Plug}.
   * </p>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Sink",
   *   name: "sink",
   *   place: { in: "Standing Room" },
   *   descriptions: {
   *     look: function()
   *     {
   *       return "A pedestal sink with porcelain handles
   *       and a stainless steel faucet. Its drain appears to
   *       be $( sink drain is| open or| closed ). ";
   *     },
   *   },
   *   in: {
   *     vessel: {
   *       drain_id: "sink drain",
   *     }
   *   },
   *   parts: [
   *     "hot water handle",
   *     "cold water handle",
   *     "faucet",
   *     "drain",
   *     "plug"
   *   ],
   * });
   * MyGame.createAsset({
   *   class: "Drain",
   *   name: "sink drain",
   *   synonyms: "sink drain",
   *   is: { open: true, },
   *   dov: { open: true, close: true, },
   *   descriptions: {
   *     look: function()
   *     {
   *       return "A dark drain. Currently
   *       $( sink drain is| open or| closed ). "
   *     },
   *   },
   * });
   * MyGame.createAsset({
   *   class: "Faucet",
   *   name: "faucet",
   *   descriptions: { look: "The sink faucet. ", },
   *   substance_id: "water",
   *   max_volume_of_flow_per_turn: 1000,
   * });
   * MyGame.createAsset({
   *   class: "Handle",
   *   name: "hot water handle",
   *   synonyms: [ "handle", "sink handle" ],
   *   adjectives: [ "hot water", "sink", "porcelain" ],
   *   descriptions: { look: "The sink's hot water handle. ", },
   *   set_substance_id: "hot water",
   *   set_substance_temperature: 70
   * });
   * MyGame.createAsset({
   *   class: "Handle",
   *   name: "cold water handle",
   *   descriptions: { look: "The sink's cold water handle. ", },
   *   set_substance_id: "cold water",
   *   set_substance_temperature: 20
   * });
   * MyGame.createAsset({
   *   class: "Collection",
   *   name: "sink handles",
   *   synonyms: [ "porcelain handles" ],
   *   place: { attached: "sink" },
   *   collection: [ "hot water handle", "cold water handle"],
   *   is: { listed_in_parent: false },
   *   descriptions: { look: "Two porcelain sink handles, hot and cold. ", },
   * });
   * MyGame.createAsset({
   *   class: "Plug",
   *   name: "sink plug",
   *   synonyms: "plug",
   *   place: { in: "sink" },
   *   descriptions: { look: "A sink 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 Sink extends adventurejs.Drainable {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Sink";

      this.noun = "sink";
      this.plural = "sinks";
      this.singlePluralPairs = [["sink", "sinks"]];
      this.default_aspect = "in";

      this.setDOVs(["turn", "plug"]);
      this.setDOV({ unplug: { with_nothing: true } });
      this.setIOVs(["put", "take"]);

      this.aspects.in.set({
        maxheight: 2,
        maxwidth: 2,
        maxdepth: 2,
        maxcount: 5,
        maxsize: 2,
        maxweight: 10,
        list_in_examine: true,
        list_in_room: true,
        player: { can: { enter: false } },
      });

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