diff --git a/markdown/bitburner.resetinfo.md b/markdown/bitburner.resetinfo.md index 6fc4b31f3..023835a03 100644 --- a/markdown/bitburner.resetinfo.md +++ b/markdown/bitburner.resetinfo.md @@ -21,5 +21,5 @@ interface ResetInfo | [lastAugReset](./bitburner.resetinfo.lastaugreset.md) | | number | Numeric timestamp (from Date.now()) of last augmentation reset | | [lastNodeReset](./bitburner.resetinfo.lastnodereset.md) | | number | Numeric timestamp (from Date.now()) of last BitNode reset | | [ownedAugs](./bitburner.resetinfo.ownedaugs.md) | | Map<string, number> | A map of owned augmentations to their levels. Keyed by the augmentation name. Map values are the augmentation level (e.g. for NeuroFlux governor). | -| [ownedSF](./bitburner.resetinfo.ownedsf.md) | | Map<number, number> | A map of owned SF to their levels. Keyed by the SF number. Map values are the SF level. | +| [ownedSF](./bitburner.resetinfo.ownedsf.md) | | Map<number, number> |

A map of owned source files. Its keys are the SF numbers. Its values are the active SF levels. This map takes BitNode options into account.

For example, let's say you have SF 1.3, but you overrode the active level of SF1 and set it to level 1. In this case, this map contains this entry: Key: 1 => Value: 1.

If the active level of a source file is 0, that source file won't be included in the result.

| diff --git a/markdown/bitburner.resetinfo.ownedsf.md b/markdown/bitburner.resetinfo.ownedsf.md index f22e0d8bb..4d9358e4c 100644 --- a/markdown/bitburner.resetinfo.ownedsf.md +++ b/markdown/bitburner.resetinfo.ownedsf.md @@ -4,7 +4,11 @@ ## ResetInfo.ownedSF property -A map of owned SF to their levels. Keyed by the SF number. Map values are the SF level. +A map of owned source files. Its keys are the SF numbers. Its values are the active SF levels. This map takes BitNode options into account. + +For example, let's say you have SF 1.3, but you overrode the active level of SF1 and set it to level 1. In this case, this map contains this entry: Key: 1 => Value: 1. + +If the active level of a source file is 0, that source file won't be included in the result. **Signature:** diff --git a/markdown/bitburner.singularity.getownedsourcefiles.md b/markdown/bitburner.singularity.getownedsourcefiles.md index 7613cd881..61baf7429 100644 --- a/markdown/bitburner.singularity.getownedsourcefiles.md +++ b/markdown/bitburner.singularity.getownedsourcefiles.md @@ -21,5 +21,9 @@ Array containing an object with number and level of the source file. RAM cost: 5 GB -Returns an array of source files +Returns an array of source files. This function takes BitNode options into account. + +For example, let's say you have SF 1.3, but you overrode the active level of SF1 and set it to level 1. In this case, this function returns {"n":1,"lvl":1}. + +If the active level of a source file is 0, that source file won't be included in the result. diff --git a/src/NetscriptFunctions.ts b/src/NetscriptFunctions.ts index 11f8fcd75..ecc4593be 100644 --- a/src/NetscriptFunctions.ts +++ b/src/NetscriptFunctions.ts @@ -1825,7 +1825,11 @@ export const ns: InternalAPI = { lastNodeReset: Player.lastNodeReset, currentNode: Player.bitNodeN, ownedAugs: new Map(Player.augmentations.map((aug) => [aug.name, aug.level])), - ownedSF: new Map(Player.sourceFiles), + ownedSF: new Map( + [...Player.activeSourceFiles].filter(([__, activeLevel]) => { + return activeLevel > 0; + }), + ), bitNodeOptions: { ...Player.bitNodeOptions, sourceFileOverrides: new Map(Player.bitNodeOptions.sourceFileOverrides), diff --git a/src/NetscriptFunctions/Singularity.ts b/src/NetscriptFunctions/Singularity.ts index c66f5291d..3f1dda057 100644 --- a/src/NetscriptFunctions/Singularity.ts +++ b/src/NetscriptFunctions/Singularity.ts @@ -88,7 +88,13 @@ export function NetscriptSingularity(): InternalAPI { } return res; }, - getOwnedSourceFiles: () => () => [...Player.sourceFiles].map(([n, lvl]) => ({ n, lvl })), + getOwnedSourceFiles: () => () => { + return [...Player.activeSourceFiles] + .filter(([__, activeLevel]) => { + return activeLevel > 0; + }) + .map(([n, lvl]) => ({ n, lvl })); + }, getAugmentationFactions: (ctx) => (_augName) => { helpers.checkSingularityAccess(ctx); const augName = getEnumHelper("AugmentationName").nsGetMember(ctx, _augName); diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index 17784864a..b49a1e460 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -74,7 +74,15 @@ interface ResetInfo { currentNode: number; /** A map of owned augmentations to their levels. Keyed by the augmentation name. Map values are the augmentation level (e.g. for NeuroFlux governor). */ ownedAugs: Map; - /** A map of owned SF to their levels. Keyed by the SF number. Map values are the SF level. */ + /** + * A map of owned source files. Its keys are the SF numbers. Its values are the active SF levels. This map takes + * BitNode options into account. + * + * For example, let's say you have SF 1.3, but you overrode the active level of SF1 and set it to level 1. In this + * case, this map contains this entry: Key: 1 => Value: 1. + * + * If the active level of a source file is 0, that source file won't be included in the result. + */ ownedSF: Map; /** Current BitNode options */ bitNodeOptions: BitNodeOptions; @@ -2435,7 +2443,12 @@ export interface Singularity { * RAM cost: 5 GB * * - * Returns an array of source files + * Returns an array of source files. This function takes BitNode options into account. + * + * For example, let's say you have SF 1.3, but you overrode the active level of SF1 and set it to level 1. In this + * case, this function returns {"n":1,"lvl":1}. + * + * If the active level of a source file is 0, that source file won't be included in the result. * * @returns Array containing an object with number and level of the source file. */