///
///
class ActionSaveGame extends Action {
public requiresTurn = false;
public requiresNoun = false;
public requiresVisibility = false;
public static check : Rulebook = new Rulebook("Check Saving");
public static carry : Rulebook = new Rulebook("Carry out Saving");
public getCommandText () {
return "save to file";
}
}
ActionSaveGame.carry.addRule(new Rule({
name : "Save the game",
code : runner => {
SaveHandler.saveToFile();
runner.noun.say.add("Saved.");
}
}));
Elements.HyperlinkHandler.CommonActionsRulebook.addRule(new Rule({
name : "Add Save Command Rule",
firstPriority : Rule.PRIORITY_LOWEST,
priority : Rule.PRIORITY_LOWEST,
code : (rulebook : RulebookRunner) => {
Elements.HyperlinkHandler.addCommonAction("Save", new ActionSaveGame(WorldState.player));
}
}));