// Luggage.js
(function () {
/*global adventurejs A*/
"use strict";
/**
* @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Luggage
* @augments adventurejs.Thing
* @class adventurejs.Luggage
* @ajsconstruct MyGame.createAsset({ "class":"Luggage", "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 A base class for all kinds of luggage.
* @tutorial Tangibles_Aspects
* @ajstangiblecontainer in
* @classdesc
* <p>
* <strong>Luggage</strong> is a parent class for all
* kinds of carry containers. See
* {@link adventurejs.Knapsack|Knapsack} for an example
* of a Luggage subclass that can be
* worn and removed. It's possible to limit what can
* be put in Luggage 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 Luggage 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: "Luggage",
* name: "purse",
* place: { on: "Coat rack" },
* descriptions: { look: "It's Prada, dahling. ", },
* adjectives: "prada",
* dov: { wear: true, remove: true },
* in:
* {
* maxheight: .25,
* maxwidth: .25,
* maxdepth: .1,
* maxcount: 6, // can't hold more than 6 things
* maxweight: 5, // can't carry more than 5 units
* }
* });
* </code></pre>
* <p>
* This example shows a Luggage instance that only
* allows player to put certain items or classes in it.
* </p>
* <pre class="display"><code class="language-javascript">MyGame.createAsset({
* class: "Luggage",
* name: "makeup bag",
* place: { on: "Coat rack" },
* descriptions: { look: "I never leave home without it. ", },
* dov: { wear: true, remove: true },
* aspects: { in:
* {
* with_classes: ["Makeup"], // any instance
* with_assets: ["lipstick", "compact", "eye liner"], // specific items
* }, },
* });
* </code></pre>
**/
class Luggage extends adventurejs.Thing {
constructor(name, game_name) {
super(name, game_name);
this.class = "Luggage";
this.is.closed = true;
this.is.hollow = true;
// give & take depends on size of chest - up to author
this.setDOVs(["put", "give", "take", "drop", "throw"]);
this.setDOV({ open: { with_nothing: true } });
this.setDOV({ close: { with_nothing: true } });
this.aspects.in = new adventurejs.Aspect("in", this.game_name).set({
parent_id: this.id,
list_in_examine: true,
});
}
}
adventurejs.Luggage = Luggage;
})();