Slash-The-Hordes/utils/regenerateGameSettings.ts

18 lines
671 B
TypeScript
Raw Normal View History

2022-11-24 12:17:05 +00:00
import { readFileSync, writeFileSync } from "fs";
import { merge } from "lodash";
import { GameSettings } from "../assets/Scripts/Game/Data/GameSettings";
regenerateGameSettings();
function regenerateGameSettings(): void {
const settingsPath: string = process.argv[2];
const blankSettings: GameSettings = new GameSettings();
const savedSettingsJson: string = readFileSync(settingsPath, "utf8");
const savedSettings: GameSettings = <GameSettings>JSON.parse(savedSettingsJson);
const result: GameSettings = merge(blankSettings, savedSettings);
writeFileSync(settingsPath, JSON.stringify(result));
2022-11-24 12:20:30 +00:00
console.log("Game settings regenerated");
2022-11-24 12:17:05 +00:00
}