1
1

ActionWait.ts 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. /// <reference path="../Action.ts" />
  2. /// <reference path="../../../Elements/Modules/HyperlinkHandler.ts" />
  3. class ActionWait extends Action {
  4. public requiresTurn = true;
  5. public requiresNoun = false;
  6. public requiresVisibility = false;
  7. public static check : Rulebook<ActionWait> = new Rulebook("Check Waiting");
  8. public static carry : Rulebook<ActionWait> = new Rulebook("Carry out Waiting");
  9. public getCommandText () {
  10. return "wait";
  11. }
  12. }
  13. ActionWait.carry.addRule(new Rule({
  14. name : "Print waiting message",
  15. code : runner => {
  16. if (runner.noun.actor == WorldState.player) {
  17. runner.noun.say.add("You wait.");
  18. }
  19. }
  20. }));
  21. Elements.HyperlinkHandler.CommonActionsRulebook.addRule(new Rule({
  22. name : "Add Wait Command Rule",
  23. firstPriority : Rule.PRIORITY_HIGHEST,
  24. priority : Rule.PRIORITY_MEDIUM,
  25. code : (rulebook : RulebookRunner<void>) => {
  26. Elements.HyperlinkHandler.addCommonAction("Wait", new ActionWait(WorldState.player));
  27. }
  28. }));