* handle enums differently
* Enums are frozen and fed directly to the proxy
* Enums are not included in the NSFull definition, allowing samekeys for RamCostTree<API>, InternalAPI<API>, and ExternalAPI<API>
* Rewrote a lot of the ramcalc test, with better typing thanks to the samekeys above
* Fix ns1 for proxy (args, pid, and enums after above changes were not being added to ns1 scripts.)
* Fixed an overview issue where the bars could display inaccurately.
Update changelog and bump version to 2.2.1
This commit is contained in:
Snarling
2023-01-04 09:23:20 -05:00
committed by omuretsu
parent 5f18b87323
commit 31bf0c43d1
8 changed files with 124 additions and 132 deletions
+4 -3
View File
@@ -91,11 +91,12 @@ export const enums: NSEnums = {
ToastVariant,
UniversityClassType,
};
for (const val of Object.values(enums)) Object.freeze(val);
Object.freeze(enums);
export type NSFull = Readonly<Omit<NS & INetscriptExtra, "pid" | "args">>;
export type NSFull = Readonly<Omit<NS & INetscriptExtra, "pid" | "args" | "enums">>;
export const ns: InternalAPI<NSFull> = {
enums,
singularity: NetscriptSingularity(),
gang: NetscriptGang(),
bladeburner: NetscriptBladeburner(),
@@ -1894,7 +1895,7 @@ Object.assign(ns, {
});
export function NetscriptFunctions(ws: WorkerScript): ExternalAPI<NSFull> {
return NSProxy(ws, ns, [], { args: ws.args.slice(), pid: ws.pid });
return NSProxy(ws, ns, [], { args: ws.args.slice(), pid: ws.pid, enums });
}
const possibleLogs = Object.fromEntries([...getFunctionNames(ns, "")].map((a) => [a, true]));