Pre-release
Adventure.js Docs Downloads
Score: 0 Moves: 0
// Schmack.js
(function () {
  /*global adventurejs A*/
  "use strict";

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Schmack
   * @augments adventurejs.Thing
   * @class adventurejs.Schmack
   * @ajsconstruct MyGame.createAsset({ "class":"Schmack", "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 place to hang your coat. And hat, of course.
   * @ajstangiblecontainer on
   * @classdesc
   * <p>
   * <strong>Schmack</strong> is a simple subclass of
   * {@link adventurejs.Thing|Thing} that can have things
   * hung on it. By default it does not exclude anything
   * from being hung, which might lead to players hanging
   * odd things. See the example below for an example of
   * how to restrict a Schmack to cloathing.
   * </p>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Schmack",
   *   name: "schmack",
   *   synonyms: "rack",
   *   place: { in: "Foyer" },
   *   descriptions: { look: "It's a schmack. ", },
   *   aspects: { on: {
   *     with_classes: ["Clothing"]
   *   }, },
   * });
   * </code></pre>
   * <p>
   * It's also possible to allow only certain objects
   * to be hung.
   * </p>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Schmack",
   *   name: "schmack",
   *   place: { in: "Foyer" },
   *   descriptions: { look: "It's a schmack. ", },
   *   on: {
   *     with_assets: ["burberry coat", "mackintosh coat"]
   *   }
   * });
   * </code></pre>
   * <p>
   * The above example uses <code class="property">with_classes</code>
   * and <code class="property">with_assets</code> to limit what a
   * player can put in without having to write custom
   * failure code for every object. To learn more, see
   * <a href="/doc/Tangibles_Aspects.html">How to Use Aspects</a>.
   * </p>
   **/
  class Schmack extends adventurejs.Thing {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Schmack";
      this.setIOVs(["put", "hang", "take", "tie"]);
      this.can.hang_things_on_this = true;
      this.is.listed_in_room = false;
      this.aspects.on = new adventurejs.Aspect("on", this.game_name).set({
        parent_id: this.id,
        maxcount: 4,
      });
    }
  }

  adventurejs.Schmack = Schmack;
})();