Pre-release
AdventureJS Docs Downloads Bundler Devlog
Score: 0 Moves: 0
// restrictInput.js

(function () {
  /* global AdventureJS A */

  var p = AdventureJS.Parser.prototype;

  /**
   * Restrict input only to the specified words. Used for
   * temporary restrictions, such as when an author only
   * wants to allow a user a limited set of options, such
   * as "undo | restore | restart | quit".
   * @memberOf AdventureJS.Parser
   * @method AdventureJS.Parser#restrictInput
   * @param {Array} words A list of verbs words.
   * @param {Boolean} reset Whether to reset after one turn.
   */
  p.restrictInput = function Parser_restrictInput(verbs, reset = true) {
    this.game.log(
      "L1718",
      "log",
      "high",
      `[restrictInput.js] restrictInput() receive: verbs ${verbs}, reset ${reset}`,
      "Parser"
    );

    this.input_restrictions = verbs;
    this.clear_restrictions = reset;
  };
})();