This commit is contained in:
Olivier Gagnon 2021-12-14 15:56:11 -05:00
parent de9fb24156
commit 4d80813707
4 changed files with 6 additions and 5 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -531,6 +531,8 @@ function createAndAddWorkerScript(runningScriptObj: RunningScript, server: BaseS
// Once the code finishes (either resolved or rejected, doesnt matter), set its // Once the code finishes (either resolved or rejected, doesnt matter), set its
// running status to false // running status to false
p.then(function (w: WorkerScript) { p.then(function (w: WorkerScript) {
w.running = false;
w.env.stopFlag = true;
// On natural death, the earnings are transfered to the parent if it still exists. // On natural death, the earnings are transfered to the parent if it still exists.
if (parent !== undefined) { if (parent !== undefined) {
if (parent.running) { if (parent.running) {
@ -571,8 +573,6 @@ function createAndAddWorkerScript(runningScriptObj: RunningScript, server: BaseS
w.log("", () => "Script killed"); w.log("", () => "Script killed");
return; // Already killed, so stop here return; // Already killed, so stop here
} }
w.running = false;
w.env.stopFlag = true;
} else if (isScriptErrorMessage(w)) { } else if (isScriptErrorMessage(w)) {
dialogBoxCreate("Script runtime unknown error. This is a bug please contact game developer"); dialogBoxCreate("Script runtime unknown error. This is a bug please contact game developer");
console.error( console.error(

@ -52,6 +52,7 @@ export function runScript(
} }
// Check for admin rights and that there is enough RAM availble to run // Check for admin rights and that there is enough RAM availble to run
const script = server.scripts[i]; const script = server.scripts[i];
script.server = player.getCurrentServer().hostname;
const ramUsage = script.ramUsage * numThreads; const ramUsage = script.ramUsage * numThreads;
const ramAvailable = server.maxRam - server.ramUsed; const ramAvailable = server.maxRam - server.ramUsed;