// Furniture.js
(function () {
/*global adventurejs A*/
"use strict";
/**
* @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Furniture
* @augments adventurejs.Thing
* @class adventurejs.Furniture
* @ajsconstruct MyGame.createAsset({ "class":"Furniture", "name":"foo", [...] })
* @ajsconstructedby adventurejs.Game#createAsset
* @ajsnavheading FurnitureClasses
* @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 furniture.
* @tutorial Tangibles_AboutTangibles
* @ajstangiblecontainer on
* @classdesc
* <p>
* <strong>Furniture</strong> is the ancestor class for
* all types of furniture including
* {@link adventurejs.Bed|Bed},
* {@link adventurejs.Chair|Chair},
* {@link adventurejs.Table|Table}, and
* {@link adventurejs.Desk|Desk}.
* </p>
* <p>Note that Furniture and its subclasses have their
* <code class="property">group</code> property set
* to "furniture", which allows players to use the word
* "furniture" as a shortcut to refer to all Furniture
* instances that are present in the current
* {@link adventurejs.Room|Room}. Doing so will prompt
* the player for disambiguation and offer a list of
* available {@link adventurejs.Asset|Assets}, for example:
* </p>
* <pre class="display border outline">
* <span class="input">> x furniture</span>
* Which did you mean? 1. The stained bed,
* 2. the crooked table, 3. the unsprung chair, or
* 4. the blasted desk?
* </pre>
* <h3 class="examples">Example:</h3>
* <pre class="display"><code class="language-javascript">MyGame.createAsset({
* class: "Desk",
* name: "desk",
* place: { in: "Ancient classroom" },
* descriptions: {
* look: function()
* {
* return "It's a heavy wooden desk with three
* vertically stacked drawers. The top drawer is
* $( top drawer is| open or| closed ),
* the middle drawer is
* $( middle drawer is| open or| closed ),
* and the bottom drawer is
* $( bottom drawer is| open or| closed )."
* },
* },
* adjectives: "wooden, heavy",
* });
* </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 Furniture extends adventurejs.Thing {
constructor(name, game_name) {
super(name, game_name);
this.class = "Furniture";
this.group = ["furniture"];
this.setDOVs(["climb", "stand", "sit", "lie", "tie"]);
this.unsetDOVs(["take", "give", "put"]);
this.setIOVs(["take"]);
//this.is.climbable = true;
this.quirks.climb_means_go_on = true;
this.quirks.stand_means_get_off = true;
this.can.jump_to = true;
this.can.jump_from = true;
this.default_aspect = "on";
this.dimensions.height = 0.5;
this.aspects.on = new adventurejs.Aspect("on", this.game_name).set({
parent_id: this.id,
list_in_room: true,
list_in_examine: true,
maxheight: 6,
maxwidth: 6,
maxdepth: 6,
maxcount: 10,
maxsize: 20,
maxweight: 100,
player: {
posture: "sit",
preposition: "on",
can: {
enter: true,
sit: true,
kneel: true,
lie: true,
stand: true,
},
},
orientation: "horizontal",
});
this.quirks.step_on_means_stand_on = true;
this.quirks.climb_means_stand_on = true;
}
}
adventurejs.Furniture = Furniture;
})();