From a2dddb0e5aa8bb2011cf213c4674cdf18d4feca4 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Fri, 8 Apr 2022 00:28:37 -0400 Subject: [PATCH] Fix soft reset not installing augs anymore --- src/Augmentation/AugmentationHelpers.tsx | 18 ++++++++++-------- src/NetscriptFunctions/Singularity.ts | 2 +- src/ui/GameRoot.tsx | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/Augmentation/AugmentationHelpers.tsx b/src/Augmentation/AugmentationHelpers.tsx index 6078ae182..ffe362a4f 100644 --- a/src/Augmentation/AugmentationHelpers.tsx +++ b/src/Augmentation/AugmentationHelpers.tsx @@ -154,8 +154,8 @@ function applyAugmentation(aug: IPlayerOwnedAugmentation, reapply = false): void } } -function installAugmentations(): boolean { - if (Player.queuedAugmentations.length == 0) { +function installAugmentations(force?: boolean): boolean { + if (Player.queuedAugmentations.length == 0 && !force) { dialogBoxCreate("You have not purchased any Augmentations to install!"); return false; } @@ -185,12 +185,14 @@ function installAugmentations(): boolean { augmentationList += aug.name + level + "
"; } Player.queuedAugmentations = []; - dialogBoxCreate( - "You slowly drift to sleep as scientists put you under in order " + - "to install the following Augmentations:
" + - augmentationList + - "
You wake up in your home...you feel different...", - ); + if (!force) { + dialogBoxCreate( + "You slowly drift to sleep as scientists put you under in order " + + "to install the following Augmentations:
" + + augmentationList + + "
You wake up in your home...you feel different...", + ); + } prestigeAugmentation(); return true; } diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index 79393a61a..cc5f065c3 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -212,7 +212,7 @@ export function NetscriptSingularity( workerScript.log("softReset", () => "Soft resetting. This will cause this script to be killed"); setTimeout(() => { - prestigeAugmentation(); + installAugmentations(true); runAfterReset(cbScript); }, 0); diff --git a/src/ui/GameRoot.tsx b/src/ui/GameRoot.tsx index 3934fbd6c..aec6cf48f 100644 --- a/src/ui/GameRoot.tsx +++ b/src/ui/GameRoot.tsx @@ -310,7 +310,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme function softReset(): void { dialogBoxCreate("Soft Reset!"); - prestigeAugmentation(); + installAugmentations(true); resetErrorBoundary(); Router.toTerminal(); }