Add ns.getFunctionRamCost (#526)

This commit is contained in:
G4mingJon4s
2023-05-26 13:46:08 +02:00
committed by GitHub
parent 294603fff8
commit 113af6e711
5 changed files with 48 additions and 6 deletions
+5
View File
@@ -93,6 +93,7 @@ import { ContentFilePath } from "./Paths/ContentFile";
import { LiteratureName } from "./Literature/data/LiteratureNames";
import { hasProgramExtension } from "./Paths/ProgramFilePath";
import { hasContractExtension } from "./Paths/ContractFilePath";
import { getRamCost } from "./Netscript/RamCostGenerator";
export const enums: NSEnums = {
CityName,
@@ -1737,6 +1738,10 @@ export const ns: InternalAPI<NSFull> = {
lastNodeReset: Player.lastNodeReset,
currentNode: Player.bitNodeN,
}),
getFunctionRamCost: (ctx) => (_name) => {
const name = helpers.string(ctx, "name", _name);
return getRamCost(...name.split("."));
},
flags: Flags,
...NetscriptExtra(),
};