Skip to content

Commit

Permalink
feat(core): Remove support for development savegames
Browse files Browse the repository at this point in the history
Using the new state management is far more convenient than this, and it wasn't actively used for a long time either.
  • Loading branch information
oliversalzburg committed Jan 24, 2023
1 parent 9e7e181 commit 6378b02
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 14 deletions.
1 change: 0 additions & 1 deletion packages/userscript/source/UserScript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { GamePage } from "./types";
import { UserInterface } from "./ui/UserInterface";

declare global {
const KG_SAVEGAME: string | null;
const KS_VERSION: string | null;
let unsafeWindow: Window | undefined;
interface Window {
Expand Down
10 changes: 1 addition & 9 deletions packages/userscript/source/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
import { SettingsStorage } from "./settings/SettingsStorage";
import { cerror, cinfo, cwarn } from "./tools/Log";
import { isNil } from "./tools/Maybe";
import { SavegameLoader } from "./tools/SavegameLoader";
import { UserScript } from "./UserScript";

const devSavegame = KG_SAVEGAME ?? null;

(async () => {
const kittenGame = await UserScript.waitForGame();
await UserScript.waitForGame();

const userScript = UserScript.getDefaultInstance();

// For development convenience, load a lategame save to give us more test options.
if (!isNil(devSavegame)) {
await new SavegameLoader(kittenGame).load(devSavegame);
}

// @ts-expect-error Manipulating global containers is naughty, be we want to expose the script host.
window.kittenScientists = userScript;

Expand Down
2 changes: 0 additions & 2 deletions packages/userscript/vite.config.inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import manifest from "./package.json" assert { type: "json" };

const filename = "kitten-scientists.inject.js";

const KG_SAVEGAME = process.env.KG_SAVEGAME ?? null;
const KS_SETTINGS = process.env.KS_SETTINGS ?? null;
const KS_VERSION = JSON.stringify(process.env.KS_VERSION ?? `${manifest.version}-live`);

Expand All @@ -25,7 +24,6 @@ export default defineConfig({
sourcemap: "inline",
},
define: {
KG_SAVEGAME,
KS_SETTINGS,
KS_VERSION,
},
Expand Down
2 changes: 0 additions & 2 deletions packages/userscript/vite.config.userscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const filename = ["kitten-scientists", `-${versionString}`, minify ? ".min" : ""
""
);

const KG_SAVEGAME = process.env.KG_SAVEGAME ?? null;
const KS_SETTINGS = process.env.KS_SETTINGS ?? null;
const KS_VERSION = JSON.stringify(versionString);

Expand Down Expand Up @@ -60,7 +59,6 @@ export default defineConfig({
},
},
define: {
KG_SAVEGAME,
KS_SETTINGS,
KS_VERSION,
},
Expand Down

0 comments on commit 6378b02

Please sign in to comment.