Merge pull request #1808 from theit8514/move-getownedsourcefiles

Move getOwnedSourceFiles to NS namespace
This commit is contained in:
hydroflame 2021-12-02 12:41:23 -05:00 committed by GitHub
commit 2b7acf6012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 29 deletions

2
dist/bitburner.d.ts vendored

@ -4085,8 +4085,6 @@ export declare interface Singularity {
* @remarks
* RAM cost: 5 GB
*
* Singularity - Level 3
*
* Returns an array of source files
*
* @returns Array containing an object with number and level of the source file.

@ -63,7 +63,7 @@ import { NetscriptGang } from "./NetscriptFunctions/Gang";
import { NetscriptSleeve } from "./NetscriptFunctions/Sleeve";
import { NetscriptExtra } from "./NetscriptFunctions/Extra";
import { NetscriptHacknet } from "./NetscriptFunctions/Hacknet";
import { NS as INS, Player as INetscriptPlayer } from "./ScriptEditor/NetscriptDefinitions";
import { NS as INS, Player as INetscriptPlayer, SourceFileLvl } from "./ScriptEditor/NetscriptDefinitions";
import { NetscriptBladeburner } from "./NetscriptFunctions/Bladeburner";
import { NetscriptCodingContract } from "./NetscriptFunctions/CodingContract";
import { NetscriptCorporation } from "./NetscriptFunctions/Corporation";
@ -2150,7 +2150,17 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
updateDynamicRam("getFavorToDonate", getRamCost("getFavorToDonate"));
return Math.floor(CONSTANTS.BaseFavorToDonate * BitNodeMultipliers.RepToDonateToFaction);
},
getOwnedSourceFiles: function (): SourceFileLvl[] {
helper.updateDynamicRam("getOwnedSourceFiles", getRamCost("getOwnedSourceFiles"));
const res: SourceFileLvl[] = [];
for (let i = 0; i < Player.sourceFiles.length; ++i) {
res.push({
n: Player.sourceFiles[i].n,
lvl: Player.sourceFiles[i].lvl,
} as SourceFileLvl);
}
return res;
},
getPlayer: function (): INetscriptPlayer {
helper.updateDynamicRam("getPlayer", getRamCost("getPlayer"));

@ -105,18 +105,6 @@ export function NetscriptSingularity(
}
return res;
},
getOwnedSourceFiles: function (): any {
helper.updateDynamicRam("getOwnedSourceFiles", getRamCost("getOwnedSourceFiles"));
helper.checkSingularityAccess("getOwnedSourceFiles", 3);
const res = [];
for (let i = 0; i < player.sourceFiles.length; ++i) {
res.push({
n: player.sourceFiles[i].n,
lvl: player.sourceFiles[i].lvl,
});
}
return res;
},
getAugmentationsFromFaction: function (facname: any): any {
helper.updateDynamicRam("getAugmentationsFromFaction", getRamCost("getAugmentationsFromFaction"));
helper.checkSingularityAccess("getAugmentationsFromFaction", 3);

@ -1747,19 +1747,6 @@ export interface Singularity {
*/
getOwnedAugmentations(purchased?: boolean): string[];
/**
* Get a list of acquired Source-Files.
* @remarks
* RAM cost: 5 GB
*
* Singularity - Level 3
*
* Returns an array of source files
*
* @returns Array containing an object with number and level of the source file.
*/
getOwnedSourceFiles(): SourceFileLvl[];
/**
* Get a list of augmentation available from a faction.
* @remarks
@ -4978,6 +4965,17 @@ export interface NS extends Singularity {
*/
getBitNodeMultipliers(): BitNodeMultipliers;
/**
* Get a list of acquired Source-Files.
* @remarks
* RAM cost: 5 GB
*
* Returns an array of source files
*
* @returns Array containing an object with number and level of the source file.
*/
getOwnedSourceFiles(): SourceFileLvl[];
/**
* Get information about the player.
* @returns Player info