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

  /**
   * @ajstangiblecontainer in
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Luggage.Pouch
   * @augments adventurejs.Luggage
   * @class adventurejs.Pouch
   * @ajsconstruct MyGame.createAsset({ "class":"Pouch", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading LuggageClasses
   * @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 For carrying anything and everything.
   * @tutorial Tangibles_Aspects
   * @classdesc
   * <p>
   * <strong>Pouch</strong> is a subclass of
   * {@link adventurejs.Luggage|Luggage}.
   * It's possible to limit what can
   * be put in it by size, weight, and quantity.
   * It's also possible to restrict its contents to
   * certain classes or specific items.
   * </p>
   * <h3 class="examples">Example:</h3>
   * <p>
   * This example shows a Pouch instance that with
   * restrictions on the size, number, and weight of
   * things that can be put in it.
   * </p>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Pouch",
   *   name: "leather pouch",
   *   place: { in: "Closet" },
   *   descriptions: { look: "It's a small leather pouch for dice. ", },
   *   in:
   *   {
   *     contents_limits: {
   *       height: 0.25,
   *       width: 0.1,
   *       depth: 0.25,
   *       count: 4,
   *       weight: 2,
   *     },
   *   }
   * });
   * </code></pre>
   * <p>
   * This example shows a Pouch instance that only
   * allows player to put certain items or classes in it.
   * </p>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Pouch",
   *   name: "leather pouch",
   *   place: { in: "Closet" },
   *   descriptions: { look: "It's a small leather pouch for dice. ", },
   *   aspects: { in:
   *   {
   *     with_classes: ["Dice"], // any instance
   *     with_assets: ["marble", "pebble"], // specific items
   *   }, },
   * });
   * </code></pre>
   **/
  class Pouch extends adventurejs.Luggage {
    constructor(name, game_name, context_id = "", id = "") {
      super(name, game_name, context_id, id);
      this.class = "Pouch";

      this.singularPluralPairs = [["pouch", "pouches"]];

      this.aspects.in.set({
        know_contents_with_parent: true,
        see_contents_with_parent: true,
        contents_limits: {
          height: 0.5,
          width: 0.25,
          depth: 0.1,
          count: 10,
          weight: 5,
        },
      });

      // this.setDOVs([]);
    }
  }

  adventurejs.Pouch = Pouch;
})();