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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Climbable.Stalactite
   * @augments adventurejs.Climbable
   * @class adventurejs.Stalactite
   * @ajsconstruct MyGame.createAsset({ "class":"Stalactite", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading UndergroundClasses
   * @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 It clings tight to the ceiling.
   * @classdesc
   * <p>
   * <strong>Stalactite</strong> is a subclass of
   * {@link adventurejs.Climbable|Climbable}.
   * It hangs down from the ceiling and
   * player can climb on/to/from.
   * See its position.y and its height
   * properties in this example.
   * </p>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Stalactite",
   *   name: "stalactite",
   *   place: { in: "Cave" },
   *   descriptions: { look: "It's a stalactite. ", },
   *   position: { x:0, y:3, z:0 },
   *   height: -1,
   *   quirks.let_go_of_means_go_off: true,
   *   things_player_can_reach_from_this: [ "vine" ],
   * });
   * </code></pre>
   * <p>
   * See that the stalactite's position.y is 3 units high, presumably
   * at ceiling height, and that its height is -1, meaning that
   * it hangs down 1 unit from the ceiling and reaches to 2 units
   * above the ground, out of reach of the player.
   * </p>
   **/
  class Stalactite extends adventurejs.Climbable {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Stalactite";

      this.singlePluralPairs = [["stalactite", "stalactites"]];
      this.position.y = 2;
      this.dimensions.height = -1;
      this.player_can_hang_on_this = true;

      this.default_aspect_for_climb = "on";
      //this.quirks.climb_means_go_on = false;
      this.default_posture_for_swing_to = "hang";
      this.default_aspect_for_swing_to = "on";

      this.is.listed_in_room = false;

      this.aspects.on.set({
        player: { posture: "hang" },
        orientation: "vertical",
      });
    }
  }
  adventurejs.Stalactite = Stalactite;
})();