Set up the skeleton of an ns.closeTail function

This commit is contained in:
Undeemiss 2022-05-16 19:15:38 -05:00
parent 0121fee6e4
commit 5526355a43
3 changed files with 24 additions and 0 deletions

@ -988,6 +988,10 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
LogBoxEvents.emit(runningScriptObj); LogBoxEvents.emit(runningScriptObj);
}, },
closeTail: function (fn: any, hostname: any = workerScript.hostname, ...scriptArgs: any[]): void {
updateDynamicRam("closeTail", getRamCost(Player, "closeTail"));
// TODO
},
nuke: function (_hostname: unknown): boolean { nuke: function (_hostname: unknown): boolean {
updateDynamicRam("nuke", getRamCost(Player, "nuke")); updateDynamicRam("nuke", getRamCost(Player, "nuke"));
const hostname = helper.string("tail", "hostname", _hostname); const hostname = helper.string("tail", "hostname", _hostname);

@ -4981,6 +4981,24 @@ export interface NS {
*/ */
tail(fn?: FilenameOrPID, host?: string, ...args: any[]): void; tail(fn?: FilenameOrPID, host?: string, ...args: any[]): void;
/**
* Close the tail window of a script.
* @remarks
* RAM cost: 0 GB
*
* Closes a scripts logs. This is functionally the same pressing the "Close" button on the tail window.
*
* If the function is called with no arguments, it will close the current scripts logs.
*
* Otherwise, the fn, hostname/ip, and args arguments can be used to close the logs from another script.
* Remember that scripts are uniquely identified by both their names and arguments.
*
* @param fn - Optional. Filename or PID of the script having its tail closed. If omitted, the current script is used.
* @param host - Optional. Hostname of the script having its tail closed. Defaults to the server this script is running on. If args are specified, this is not optional.
* @param args - Arguments for the script having its tail closed.
*/
closeTail(fn?: FilenameOrPID, host?: string, ...args: any[]): void;
/** /**
* Get the list of servers connected to a server. * Get the list of servers connected to a server.
* @remarks * @remarks

@ -131,6 +131,8 @@ function LogWindow(props: IProps): React.ReactElement {
return () => clearInterval(id); return () => clearInterval(id);
}, []); }, []);
//TODO Not actually a todo I just want this file to show up as changed
//so I can find it easier later
function kill(): void { function kill(): void {
killWorkerScript(script, script.server, true); killWorkerScript(script, script.server, true);
} }