Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// Screen.js
(function () {
  /* global adventurejs A */

  /**
   * @ajspath adventurejs.Atom.Asset.Matter.Tangible.Thing.Screen
   * @augments adventurejs.Thing
   * @class adventurejs.Screen
   * @ajsconstruct MyGame.createAsset({ "class":"Screen", "name":"foo", [...] })
   * @ajsconstructedby adventurejs.Game#createAsset
   * @ajsnavheading ElectronicsClasses
   * @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 screen that can display strings input on a {@link adventurejs.Keyboard|Keyboard}.
   * @classdesc
   * <p>
   * <strong>Screen</strong> is a subclass of
   * {@link adventurejs.Thing|Thing}.
   * Setting screen's
   * <code class="property">append_typed_strings_to_description</code>
   * allows the screen to receive and display strings
   * {@link type|typed} on a
   * {@link adventurejs.Keyboard|Keyboard}.
   * </p>
   * <pre class="display border outline">
   * <span class="ajs-player-input">&gt; type "It was the best of times, it was the BLURST of times?" on keyboard</span>
   * You type "It was the best of times, it was the BLURST of times?"
   * on the keyboard. Your input appears on the screen as you type.
   *
   * <span class="ajs-player-input">&gt; x screen</span>
   * It's a fancy monitor. A line of input is visible on it:
   * "It was the best of times, it was the BLURST of times?"
   * </pre>
   * <h3 class="examples">Example:</h3>
   * <pre class="display"><code class="language-javascript">MyGame.createAsset({
   *   class: "Screen",
   *   name: "screen",
   *   place: { on: "desk" },
   *   descriptions: { look: "It's an expensive looking computer display screen. ", },
   *   dov: { take: false, },
   * });
   * MyGame.createAsset({
   *   class: "Keyboard",
   *   name: "keyboard",
   *   place: { on: "desk" },
   *   descriptions: { look: "It's a keyboard. You can type on it. ", },
   *   dov: { take: false, },
   *   typing_targets: ["screen"],
   * });
   * </code></pre>
   */
  class Screen extends adventurejs.Thing {
    constructor(name, game_name) {
      super(name, game_name);
      this.class = "Screen";

      this.append_typed_strings_to_description = true;
    }
  }
  adventurejs.Screen = Screen;
})();