Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// Lake.js
(function () {
  /*global adventurejs A*/

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Reservoir.Lake
   * @augments adventurejs.Reservoir
   * @class adventurejs.Lake
   * @ajsconstruct MyGame.createAsset({ "class":"Lake", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading ReservoirClasses
   * @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 base class for all kinds of containers which hold liquid.
   * @ajssubstancecontainer in
   * @ajstangiblecontainer in
   * @classdesc <strong>Lake</strong> is a child class
   * of {@link adventurejs.Reservoir|Reservoir}, an infinite substance
   * container that is part of the landscape.
   * It can be filled from, drunk from, and have things poured into it.
   * Unlike with smaller substance containers, no substance mixing will
   * occur if other substances are poured into it.
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Lake",
   *   name: "Dog Lake",
   *   descriptions: { look: "It's unclear why the lake was named Dog Lake. ", },
   *   contains: "water",
   * });
   * </code></pre>
   **/
  class Lake extends adventurejs.Reservoir {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Lake";

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

      this.aspects.in.player.can.swim = true;
      this.aspects.in.player.posture = "swim";

      this.contains = "water";
      //this.aspects.in.vessel.substance_id = "water";

      // this.onPourLiquidOutOfMe = function LiquidContainer_onPourLiquidOutOfMe(
      //   id
      // ) {
      //   console.log(this.name, "onPourLiquidOutOfMe", id);
      // };

      // this.doPourLiquidOutOfMe = {};

      // this.onPourLiquidIntoMe = function LiquidContainer_onPourLiquidIntoMe(
      //   id
      // ) {
      //   console.log(this.name, "onPourLiquidIntoMe", id);
      // };

      // this.doPourLiquidIntoMe = {};
    }

    initialize(game) {
      super.initialize(game);
      return this;
    }
  }
  adventurejs.Lake = Lake;
})();