Merge pull request #4052 from Snarling/ns1wrapper

NETSCRIPT: FIX #4037 ns1 wraps deeper layers correctly.
This commit is contained in:
hydroflame
2022-08-29 11:14:32 -03:00
committed by GitHub
8 changed files with 59 additions and 146 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ export function NetscriptCodingContract(): InternalAPI<ICodingContract> {
throw new Error("The answer provided was not a number, string, or array");
// Convert answer to string.
const answerStr = typeof answer === 'string' ? answer : JSON.stringify(answer);
const answerStr = typeof answer === "string" ? answer : JSON.stringify(answer);
const creward = contract.reward;
if (creward === null) throw new Error("Somehow solved a contract that didn't have a reward");
+1 -4
View File
@@ -92,7 +92,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
}
const runningScriptObj = new RunningScript(script, []); // No args
runningScriptObj.threads = 1; // Only 1 thread
startWorkerScript(player, runningScriptObj, home);
startWorkerScript(runningScriptObj, home);
}
}
};
@@ -235,8 +235,6 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
runAfterReset(cbScript);
}, 0);
// Prevent ctx.workerScript from "finishing execution naturally"
ctx.workerScript.running = false;
killWorkerScript(ctx.workerScript);
},
installAugmentations: (ctx: NetscriptContext) =>
@@ -255,7 +253,6 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
runAfterReset(cbScript);
}, 0);
ctx.workerScript.running = false; // Prevent ctx.workerScript from "finishing execution naturally"
killWorkerScript(ctx.workerScript);
return true;
},