Improve the robustness of the tutorial.

This commit is contained in:
Olivier Gagnon
2022-09-27 13:35:51 -04:00
parent c6da513eea
commit 2fc17423ff
3 changed files with 12 additions and 6 deletions

View File

@@ -13,10 +13,17 @@ import { GetServer } from "../Server/AllServers";
import { dialogBoxCreate } from "../ui/React/DialogBox";
import { AddRecentScript } from "./RecentScripts";
import { Player } from "../Player";
import { ITutorial } from "../InteractiveTutorial";
import { AlertEvents } from "../ui/React/AlertManager";
export type killScriptParams = WorkerScript | number | { runningScript: RunningScript; hostname: string };
export function killWorkerScript(params: killScriptParams): boolean {
console.log(ITutorial.isRunning);
if (ITutorial.isRunning) {
AlertEvents.emit("Processes cannot be killed during the tutorial.");
return false;
}
if (params instanceof WorkerScript) {
stopAndCleanUpWorkerScript(params);