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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Reservoir
   * @augments adventurejs.Thing
   * @class adventurejs.Reservoir
   * @ajsconstruct MyGame.createAsset({ "class":"Reservoir", "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 massive substance container.
   * @classdesc
   * <p>
   * <strong>Reservoir</strong> is the base class for
   * things like
   * {@link adventurejs.Lake|lakes} and
   * {@link adventurejs.Desert|deserts} - any infinite substance
   * container that is part of the landscape.
   * Reservoir has no particular properties - each of the
   * subclasses define unique properties.
   * </p>
   **/
  class Reservoir extends adventurejs.Thing {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Reservoir";
      this.is.listed_in_room = false;
      this.default_aspect = "in";
      this.aspects.in = new adventurejs.Aspect("in", this.game_name).set({
        list_in_room: false,
        list_in_examine: false,
        parent_id: this.id,
        player: {
          preposition: "in",
          posture: "stand",
          initial_position: { x: 0, y: 0, z: 0 },
          can: {
            bounce: true,
            crawl: true,
            enter: true,
            exit: true,
            hear: true,
            hop: true,
            jump: true,
            kneel: true,
            lie: true,
            ride: true,
            see: true,
            sit: true,
            stand: true,
            swim: false,
            walk: true,
          },
        },
      });

      this.aspects.in.vessel = new adventurejs.Vessel(
        "in",
        game_name,
        this.id
      ).set({
        parent_id: this.id,
        maxvolume: Infinity,
        reservoir: true,
        know_with_parent: true,
      });
    }

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