NETSCRIPT: Greatly speed up script launching, and remove the limitation unique args per script (#440)

* Remove the limitation unique args per script
* Internal changes to how runningScripts are stored on the server, to make common usage faster.
This commit is contained in:
David Walker
2023-04-27 15:21:06 -07:00
committed by GitHub
parent f81297dcd6
commit aa7facd4ba
44 changed files with 573 additions and 493 deletions
+4 -3
View File
@@ -5,7 +5,7 @@ import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
import { createRandomString } from "../utils/helpers/createRandomString";
import { createRandomIp } from "../utils/IPAddress";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, constructorsForReviver } from "../utils/JSONReviver";
import { IReviverValue, constructorsForReviver } from "../utils/JSONReviver";
import { IPAddress, ServerName } from "../Types/strings";
export interface IConstructorParams {
@@ -147,13 +147,14 @@ export class Server extends BaseServer {
/** Serialize the current object to a JSON save state */
toJSON(): IReviverValue {
return Generic_toJSON("Server", this);
return this.toJSONBase("Server", includedKeys);
}
// Initializes a Server Object from a JSON save state
static fromJSON(value: IReviverValue): Server {
return Generic_fromJSON(Server, value.data);
return BaseServer.fromJSONBase(value, Server, includedKeys);
}
}
const includedKeys = BaseServer.getIncludedKeys(Server);
constructorsForReviver.Server = Server;