mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-19 07:48:37 +02:00
killWorkerScript() now takes an optional argument for whether to rerenderUI. This is used to batch UI updates on killall()
This commit is contained in:
@@ -2,6 +2,7 @@ const sprintf = require("sprintf-js").sprintf;
|
||||
const vsprintf = require("sprintf-js").vsprintf;
|
||||
|
||||
import { getRamCost } from "./Netscript/RamCostGenerator";
|
||||
import { WorkerScriptStartStopEventEmitter } from "./Netscript/WorkerScriptStartStopEventEmitter";
|
||||
|
||||
import { Augmentation } from "./Augmentation/Augmentation";
|
||||
import { Augmentations } from "./Augmentation/Augmentations";
|
||||
@@ -983,18 +984,20 @@ function NetscriptFunctions(workerScript) {
|
||||
if (ip === undefined) {
|
||||
throw makeRuntimeRejectMsg(workerScript, "killall() call has incorrect number of arguments. Takes 1 argument");
|
||||
}
|
||||
var server = getServer(ip);
|
||||
const server = getServer(ip);
|
||||
if (server == null) {
|
||||
workerScript.scriptRef.log("killall() failed. Invalid IP or hostname passed in: " + ip);
|
||||
throw makeRuntimeRejectMsg(workerScript, "killall() failed. Invalid IP or hostname passed in: " + ip);
|
||||
}
|
||||
var scriptsRunning = (server.runningScripts.length > 0);
|
||||
for (var i = server.runningScripts.length-1; i >= 0; --i) {
|
||||
killWorkerScript(server.runningScripts[i], server.ip);
|
||||
const scriptsRunning = (server.runningScripts.length > 0);
|
||||
for (let i = server.runningScripts.length-1; i >= 0; --i) {
|
||||
killWorkerScript(server.runningScripts[i], server.ip, false);
|
||||
}
|
||||
WorkerScriptStartStopEventEmitter.emitEvent();
|
||||
if (workerScript.disableLogs.ALL == null && workerScript.disableLogs.killall == null) {
|
||||
workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die");
|
||||
}
|
||||
|
||||
return scriptsRunning;
|
||||
},
|
||||
exit : function() {
|
||||
|
||||
Reference in New Issue
Block a user