Pre-release
AdventureJS Docs Downloads Bundler Devlog
Score: 0 Moves: 0
// handleRestrictions.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#handleRestrictions
   */
  p.handleRestrictions = function Parser_handleRestrictions(verb = "") {
    this.game.log(
      "L1730",
      "log",
      "high",
      `[handleRestrictions.js] handleRestrictions(${verb})`,
      "Parser"
    );

    if (this.input_restrictions.includes(verb)) {
      if (this.clear_restrictions) {
        this.input_restrictions = [];
        this.clear_restrictions = true;
      }
      if (this.game.outrocard.is_shown) {
        this.game.outrocard.clear();
      }
    }
  };
})();