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
+5
View File
@@ -776,6 +776,11 @@ export const ns: InternalAPI<NSFull> = {
throw new ScriptDeath(ctx.workerScript);
}
},
self: (ctx) => () => {
const runningScript = helpers.getRunningScript(ctx, ctx.workerScript.pid);
if (runningScript == null) throw helpers.errorMessage(ctx, "Cannot find running script. This is a bug.");
return helpers.createPublicRunningScript(runningScript, ctx.workerScript);
},
kill:
(ctx) =>
(scriptID, hostname = ctx.workerScript.hostname, ...scriptArgs) => {