API: Return active SF levels in getOwnedSourceFiles and ResetInfo.ownedSF (#1761)

* DOCUMENTATION: Clarify getOwnedSourceFiles when player overrides active levels of SFs
* Return Player.activeSourceFiles instead of Player.sourceFiles
* Get rid of zeroes in the map
This commit is contained in:
catloversg
2024-11-11 13:56:57 +07:00
committed by GitHub
parent cb9e281c45
commit 72a63b15cb
6 changed files with 38 additions and 7 deletions
+7 -1
View File
@@ -88,7 +88,13 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
}
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);