mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 08:13:50 +02:00
BUGFIX: Duplicated augmentation when buying after grafting (#1536)
This commit is contained in:
@@ -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 **************/
|
||||
|
||||
Reference in New Issue
Block a user