prnd with world seed
This commit is contained in:
+10
-2
@@ -53,7 +53,11 @@ export class App {
|
||||
}
|
||||
|
||||
private showSettings(): void {
|
||||
const settings = createSettingsScreen(() => this.showMenu());
|
||||
const settings = createSettingsScreen(
|
||||
this.store.seed,
|
||||
() => this.showMenu(),
|
||||
(seed) => this.handleNewGame(seed),
|
||||
);
|
||||
this.root.replaceChildren(settings);
|
||||
}
|
||||
|
||||
@@ -69,7 +73,9 @@ export class App {
|
||||
this.gameScreen.mount();
|
||||
}
|
||||
|
||||
private handleNewGame(): void {
|
||||
/** Starts a fresh game — a freshly random seed by default, or an explicit one when called from
|
||||
* Settings' seed field (which also acts as "restart the game with this seed"). */
|
||||
private handleNewGame(seed?: number): void {
|
||||
// A resumable save existing means there's a live (not-dead) game being abandoned by starting
|
||||
// fresh instead of continuing it — record that as the last level's failure. A death already
|
||||
// records its own failure at the moment it happens (see GameStore.landRabbitStrike) and clears
|
||||
@@ -77,6 +83,8 @@ export class App {
|
||||
if (hasSave())
|
||||
this.analytics.death('restarted');
|
||||
clearSave();
|
||||
if (seed !== undefined)
|
||||
this.store.setNextSeed(seed);
|
||||
this.showGame();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user