bitburner-src/src/Terminal/commands/killall.ts

15 lines
709 B
TypeScript
Raw Normal View History

2021-09-16 01:50:44 +02:00
import { ITerminal } from "../ITerminal";
2021-09-17 08:58:02 +02:00
import { IRouter } from "../../ui/Router";
2021-09-16 01:50:44 +02:00
import { IPlayer } from "../../PersonObjects/IPlayer";
import { BaseServer } from "../../Server/BaseServer";
import { killWorkerScript } from "../../Netscript/killWorkerScript";
import { WorkerScriptStartStopEventEmitter } from "../../Netscript/WorkerScriptStartStopEventEmitter";
2021-09-17 08:58:02 +02:00
export function killall(terminal: ITerminal, router: IRouter, player: IPlayer, server: BaseServer): void {
2021-09-16 01:50:44 +02:00
for (let i = server.runningScripts.length - 1; i >= 0; --i) {
2021-10-07 23:55:49 +02:00
killWorkerScript(server.runningScripts[i], server.hostname, false);
2021-09-16 01:50:44 +02:00
}
2021-09-18 21:44:39 +02:00
WorkerScriptStartStopEventEmitter.emit();
2021-09-16 01:50:44 +02:00
terminal.print("Killing all running scripts");
}