diff --git a/src/DevMenu/ui/AugmentationsDev.tsx b/src/DevMenu/ui/AugmentationsDev.tsx
index ea4cd42d0..33d96204e 100644
--- a/src/DevMenu/ui/AugmentationsDev.tsx
+++ b/src/DevMenu/ui/AugmentationsDev.tsx
@@ -20,12 +20,19 @@ export function AugmentationsDev(): React.ReactElement {
function setAugmentationDropdown(event: SelectChangeEvent): void {
setAugmentation(event.target.value as AugmentationName);
}
+
function queueAug(): void {
+ if (Player.hasAugmentation(augmentation)) {
+ return;
+ }
Player.queueAugmentation(augmentation);
}
function queueAllAugs(): void {
for (const augName of Object.values(AugmentationName)) {
+ if (Player.hasAugmentation(augName)) {
+ continue;
+ }
Player.queueAugmentation(augName);
}
}
diff --git a/src/Faction/FactionHelpers.tsx b/src/Faction/FactionHelpers.tsx
index 52767d26d..b4efcbffd 100644
--- a/src/Faction/FactionHelpers.tsx
+++ b/src/Faction/FactionHelpers.tsx
@@ -2,7 +2,6 @@ import type { Augmentation } from "../Augmentation/Augmentation";
import type { Faction } from "./Faction";
import { Augmentations } from "../Augmentation/Augmentations";
-import { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation";
import { AugmentationName, FactionDiscovery } from "@enums";
import { currentNodeMults } from "../BitNode/BitNodeMultipliers";
@@ -84,11 +83,7 @@ export function purchaseAugmentation(aug: Augmentation, fac: Faction, sing = fal
}
dialogBoxCreate(txt);
} else if (augCosts.moneyCost === 0 || Player.money >= augCosts.moneyCost) {
- const queuedAugmentation = new PlayerOwnedAugmentation(aug.name);
- if (aug.name == AugmentationName.NeuroFluxGovernor) {
- queuedAugmentation.level = aug.getNextLevel();
- }
- Player.queuedAugmentations.push(queuedAugmentation);
+ Player.queueAugmentation(aug.name);
Player.loseMoney(augCosts.moneyCost, "augmentations");
diff --git a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx
index f6565a165..6e45362bf 100644
--- a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx
+++ b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx
@@ -156,7 +156,7 @@ export const GraftingRoot = (): React.ReactElement => {
Router.toPage(Page.Work);
}}
confirmationText={
- <>
+
Cancelling grafting will not save grafting progress, and the money you spend will not{" "}
be returned.
{!Player.hasAugmentation(AugmentationName.CongruityImplant) && (
@@ -166,7 +166,7 @@ export const GraftingRoot = (): React.ReactElement => {
Additionally, grafting an Augmentation will increase the potency of the Entropy virus.
>
)}
- >
+
}
/>
diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts b/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts
index 16c8f698a..63070fdb2 100644
--- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts
+++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.ts
@@ -50,6 +50,8 @@ import { achievements } from "../../Achievements/Achievements";
import { isCompanyWork } from "../../Work/CompanyWork";
import { isMember } from "../../utils/EnumHelper";
import { canAccessBitNodeFeature } from "../../BitNode/BitNodeUtils";
+import { AlertEvents } from "../../ui/React/AlertManager";
+import { Augmentations } from "../../Augmentation/Augmentations";
export function init(this: PlayerObject): void {
/* Initialize Player's home computer */
@@ -455,21 +457,30 @@ export function setBitNodeNumber(this: PlayerObject, n: number): void {
}
export function queueAugmentation(this: PlayerObject, name: AugmentationName): void {
- for (const aug of this.queuedAugmentations) {
- if (aug.name == name) {
- console.warn(`tried to queue ${name} twice, this may be a bug`);
- return;
+ if (name !== AugmentationName.NeuroFluxGovernor) {
+ for (const aug of this.queuedAugmentations) {
+ if (name === aug.name) {
+ AlertEvents.emit(`Tried to queue ${name} twice. This is a bug. Please contact developers.`);
+ return;
+ }
+ }
+
+ for (const aug of this.augmentations) {
+ if (aug.name === name) {
+ AlertEvents.emit(
+ `Tried to queue ${name}, but this augmentation was installed. This is a bug. Please contact developers.`,
+ );
+ return;
+ }
}
}
- for (const aug of this.augmentations) {
- if (aug.name == name) {
- console.warn(`tried to queue ${name} twice, this may be a bug`);
- return;
- }
+ const queuedAugmentation = new PlayerOwnedAugmentation(name);
+ if (name === AugmentationName.NeuroFluxGovernor) {
+ const augmentation = Augmentations[name];
+ queuedAugmentation.level = augmentation.getNextLevel();
}
-
- this.queuedAugmentations.push(new PlayerOwnedAugmentation(name));
+ this.queuedAugmentations.push(queuedAugmentation);
}
/************* Coding Contracts **************/
diff --git a/src/Work/GraftingWork.tsx b/src/Work/GraftingWork.tsx
index b9811e18b..28c47b88e 100644
--- a/src/Work/GraftingWork.tsx
+++ b/src/Work/GraftingWork.tsx
@@ -59,6 +59,14 @@ export class GraftingWork extends Work {
if (!cancelled) {
applyAugmentation({ name: augName, level: 1 });
+ // Remove this augmentation from the list of queued augmentations.
+ for (let i = 0; i < Player.queuedAugmentations.length; ++i) {
+ if (Player.queuedAugmentations[i].name === augName) {
+ Player.queuedAugmentations.splice(i, 1);
+ break;
+ }
+ }
+
if (!Player.hasAugmentation(AugmentationName.CongruityImplant, true)) {
Player.entropy += 1;
Player.applyEntropy(Player.entropy);