NETSCRIPT: Add ns.self() as a free info function (#1636)

* added utility info

* moved info to running script

* fix for RAM cost

* description changes

Co-authored-by: David Walker <d0sboots@gmail.com>

* fixed wrong formatting

* Added parent to ignored fields

---------

Co-authored-by: David Walker <d0sboots@gmail.com>
This commit is contained in:
G4mingJon4s
2024-09-08 02:34:24 +02:00
committed by GitHub
parent 0ce5cd35dc
commit 651b17739c
20 changed files with 145 additions and 7 deletions

View File

@@ -245,6 +245,13 @@ interface RunningScript {
onlineRunningTime: number;
/** Process ID. Must be an integer */
pid: number;
/**
* Process ID of the parent process.
*
* If this script was started by another script, this will be the PID of that script.
* If this script was started directly through the terminal, the value will be 0.
*/
parent: number;
/**
* How much RAM this script uses for ONE thread.
* Also known as "static RAM usage," this value does not change once the
@@ -6592,6 +6599,14 @@ export interface NS {
* @param args - Additional arguments to pass into the new script that is being run.
*/
spawn(script: string, threadOrOptions?: number | SpawnOptions, ...args: ScriptArg[]): void;
/**
* Returns the currently running script.
* @remarks
* RAM cost: 0 GB
*/
self(): RunningScript;
/**
* Terminate the script with the provided PID.
* @remarks
@@ -9502,11 +9517,22 @@ interface GameInfo {
* @public
*/
interface AutocompleteData {
/** All server hostnames */
servers: string[];
/** All scripts on the current server */
scripts: string[];
/** All text files on the current server */
txts: string[];
/** Netscript Enums */
enums: NSEnums;
/** Parses the flags schema on the already inputted flags */
flags(schema: [string, string | number | boolean | string[]][]): { [key: string]: ScriptArg | string[] };
/** The hostname of the server the script would be running on */
hostname: string;
/** The filename of the script about to be run */
filename: string;
/** The processes running on the host */
processes: ProcessInfo[];
}
/**