mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 13:43:49 +01:00
BUGFIX: Fix a bug in ns.singularity.getAugmentationFactions (#1418)
This commit is contained in:
parent
337fa4e274
commit
a62bdcafef
@ -100,7 +100,29 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
const augName = getEnumHelper("AugmentationName").nsGetMember(ctx, _augName);
|
||||
const aug = Augmentations[augName];
|
||||
return aug.factions.slice();
|
||||
const factions = aug.factions.slice();
|
||||
if (!Player.gang) {
|
||||
return factions;
|
||||
}
|
||||
const gangFactionName = Player.gang.facName;
|
||||
const augmentationListOfGangFaction = getFactionAugmentationsFiltered(Factions[gangFactionName]);
|
||||
/**
|
||||
* If the gang faction does not offer this augmentation, we need to remove the gang faction from the faction list.
|
||||
* Example: "NeuroFlux Governor"
|
||||
*/
|
||||
if (!augmentationListOfGangFaction.includes(augName)) {
|
||||
return factions.filter((factionName) => factionName !== gangFactionName);
|
||||
}
|
||||
/**
|
||||
* If the gang faction offers this augmentation, but the faction list does not contain the gang faction, we need
|
||||
* to add the gang faction to that list.
|
||||
* Example: "The Red Pill" in BN2
|
||||
*/
|
||||
if (augmentationListOfGangFaction.includes(augName) && !factions.includes(gangFactionName)) {
|
||||
factions.push(gangFactionName);
|
||||
return factions;
|
||||
}
|
||||
return factions;
|
||||
},
|
||||
getAugmentationsFromFaction: (ctx) => (_facName) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user