* 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 -7
View File
@@ -1,13 +1,10 @@
import { Player } from "@player";
import { NSFull } from "../NetscriptFunctions";
/** This type assumes any value that isn't an API layer or a function has been omitted (enum) */
type RamCostTree<API> = Omit<
{
[Property in keyof API]: API[Property] extends () => unknown ? number | (() => number) : RamCostTree<API[Property]>;
},
"enums"
>;
/** The API does not include enums, args, or pid. */
export type RamCostTree<API> = {
[key in keyof API]: API[key] extends () => unknown ? number | (() => number) : RamCostTree<API[key]>;
};
/** Constants for assigning costs to ns functions */
export const RamCostConstants = {