mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 05:05:47 +01:00
fix running/worker script comparison
This commit is contained in:
parent
39cf0cb57f
commit
1af97ec5aa
@ -10,7 +10,6 @@ import { WorkerScriptStartStopEventEmitter } from "./WorkerScriptStartStopEventE
|
|||||||
import { RunningScript } from "../Script/RunningScript";
|
import { RunningScript } from "../Script/RunningScript";
|
||||||
import { GetServer } from "../Server/AllServers";
|
import { GetServer } from "../Server/AllServers";
|
||||||
|
|
||||||
import { compareArrays } from "../utils/helpers/compareArrays";
|
|
||||||
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
import { dialogBoxCreate } from "../ui/React/DialogBox";
|
||||||
import { AddRecentScript } from "./RecentScripts";
|
import { AddRecentScript } from "./RecentScripts";
|
||||||
import { Player } from "../Player";
|
import { Player } from "../Player";
|
||||||
@ -33,13 +32,8 @@ export function killWorkerScript(params: killScriptParams): boolean {
|
|||||||
|
|
||||||
// If for some reason that doesn't work, we'll try the old way
|
// If for some reason that doesn't work, we'll try the old way
|
||||||
for (const ws of workerScripts.values()) {
|
for (const ws of workerScripts.values()) {
|
||||||
if (
|
if (ws.scriptRef === params.runningScript) {
|
||||||
ws.name == params.runningScript.filename &&
|
|
||||||
ws.hostname == params.hostname &&
|
|
||||||
compareArrays(ws.args, params.runningScript.args)
|
|
||||||
) {
|
|
||||||
stopAndCleanUpWorkerScript(ws);
|
stopAndCleanUpWorkerScript(ws);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -52,7 +46,6 @@ function killWorkerScriptByPid(pid: number): boolean {
|
|||||||
const ws = workerScripts.get(pid);
|
const ws = workerScripts.get(pid);
|
||||||
if (ws instanceof WorkerScript) {
|
if (ws instanceof WorkerScript) {
|
||||||
stopAndCleanUpWorkerScript(ws);
|
stopAndCleanUpWorkerScript(ws);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +91,7 @@ function removeWorkerScript(workerScript: WorkerScript): void {
|
|||||||
// Delete the RunningScript object from that server
|
// Delete the RunningScript object from that server
|
||||||
for (let i = 0; i < server.runningScripts.length; ++i) {
|
for (let i = 0; i < server.runningScripts.length; ++i) {
|
||||||
const runningScript = server.runningScripts[i];
|
const runningScript = server.runningScripts[i];
|
||||||
if (runningScript.filename === name && compareArrays(runningScript.args, workerScript.args)) {
|
if (runningScript === workerScript.scriptRef) {
|
||||||
server.runningScripts.splice(i, 1);
|
server.runningScripts.splice(i, 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user