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

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.OpticalDevice
   * @augments adventurejs.Thing
   * @class adventurejs.OpticalDevice
   * @ajsconstruct MyGame.createAsset({ "class":"OpticalDevice", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading OpticalClasses
   * @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 Base class for EyeGlass, Binocular, Telescope, etc.
   * @classdesc
   * <p>
   * <strong>OpticalDevice</strong> can be looked through via
   * <code>can_do_through.look</code>, or looked with via
   * <code>dov.look</code>.
   * When "with" is allowed, it resolves to "through".
   * The intention is that you can "look with" or "look through" something
   * like a spyglass, but you can only "look through" something like a window.
   * </p>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "OpticalDevice",
   *   name: "Spyglass",
   *   descriptions: { look: "A spyglass, apparently made of polished amber. ", },
   *   place: { in: "satchel" },
   * });
   * </code></pre>
   */
  class OpticalDevice extends adventurejs.Thing {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "OpticalDevice";

      // this.descriptions.look = "OpticalDevice.";
      // this.singlePluralPairs = [ ["optical device","optical devices"] ];
      this.setDOVs(["take", "give", "tie"]);
      this.setIOV("look");

      this.on_tie_to_this_take_this = true;
      this.on_tie_to_drag_behind_rope = true;

      this.quirks.look_with_means_look_through = true;
      this.is.lookthroughable = true;
    }
  }

  adventurejs.OpticalDevice = OpticalDevice;
})();