Fix soft reset not installing augs anymore

This commit is contained in:
Olivier Gagnon 2022-04-08 00:28:37 -04:00
parent 39d17986ff
commit a2dddb0e5a
3 changed files with 12 additions and 10 deletions

@ -154,8 +154,8 @@ function applyAugmentation(aug: IPlayerOwnedAugmentation, reapply = false): void
} }
} }
function installAugmentations(): boolean { function installAugmentations(force?: boolean): boolean {
if (Player.queuedAugmentations.length == 0) { if (Player.queuedAugmentations.length == 0 && !force) {
dialogBoxCreate("You have not purchased any Augmentations to install!"); dialogBoxCreate("You have not purchased any Augmentations to install!");
return false; return false;
} }
@ -185,12 +185,14 @@ function installAugmentations(): boolean {
augmentationList += aug.name + level + "<br>"; augmentationList += aug.name + level + "<br>";
} }
Player.queuedAugmentations = []; Player.queuedAugmentations = [];
if (!force) {
dialogBoxCreate( dialogBoxCreate(
"You slowly drift to sleep as scientists put you under in order " + "You slowly drift to sleep as scientists put you under in order " +
"to install the following Augmentations:<br>" + "to install the following Augmentations:<br>" +
augmentationList + augmentationList +
"<br>You wake up in your home...you feel different...", "<br>You wake up in your home...you feel different...",
); );
}
prestigeAugmentation(); prestigeAugmentation();
return true; return true;
} }

@ -212,7 +212,7 @@ export function NetscriptSingularity(
workerScript.log("softReset", () => "Soft resetting. This will cause this script to be killed"); workerScript.log("softReset", () => "Soft resetting. This will cause this script to be killed");
setTimeout(() => { setTimeout(() => {
prestigeAugmentation(); installAugmentations(true);
runAfterReset(cbScript); runAfterReset(cbScript);
}, 0); }, 0);

@ -310,7 +310,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
function softReset(): void { function softReset(): void {
dialogBoxCreate("Soft Reset!"); dialogBoxCreate("Soft Reset!");
prestigeAugmentation(); installAugmentations(true);
resetErrorBoundary(); resetErrorBoundary();
Router.toTerminal(); Router.toTerminal();
} }