mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-03-07 02:54:37 +01:00
Testing making the script runner NOT be a different web worker thread.
This commit is contained in:
@ -931,6 +931,10 @@ function runScriptsLoop() {
|
||||
if (workerScripts[i].running == false) {
|
||||
var ast = Parser(Tokenizer(InputStream(workerScripts[i].code)));
|
||||
|
||||
console.log("Starting new script: " + workerScripts[i].name);
|
||||
console.log("AST of new script:");
|
||||
console.log(ast);
|
||||
|
||||
evaluate(ast, workerScripts[i]);
|
||||
workerScripts[i].running = true;
|
||||
}
|
||||
|
@ -430,11 +430,16 @@ var Terminal = {
|
||||
|
||||
//Check if the script exists and if it does run it
|
||||
for (var i = 0; i < Player.currentServer.scripts.length; i++) {
|
||||
if (Player.currentServer.scripts[i] == scriptName) {
|
||||
if (Player.currentServer.scripts[i].filename == scriptName) {
|
||||
if (Player.currentServer.hasAdminRights == false) {
|
||||
post("Need root access to run script");
|
||||
} else {
|
||||
//TODO Run script here
|
||||
var s = new WorkerScript();
|
||||
s.name = Player.currentServer.scripts[i].filename;
|
||||
s.code = Player.currentServer.scripts[i].code;
|
||||
workerScripts.push(s);
|
||||
console.log("Pushed script onto workerScripts");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ var Engine = {
|
||||
if (Engine._scriptUpdateStatusCounter >= 50) {
|
||||
console.log("Updating Script Status");
|
||||
Engine._scriptUpdateStatusCounter = 0;
|
||||
Engine.updateScriptStatus();
|
||||
//Engine.updateScriptStatus();
|
||||
}
|
||||
|
||||
window.requestAnimationFrame(Engine.idleTimer);
|
||||
@ -252,9 +252,9 @@ var Engine = {
|
||||
CompanyPositions.init();
|
||||
}
|
||||
|
||||
if (window.Worker) {
|
||||
Engine._scriptWebWorker = new Worker("netscript/NetscriptWorker.js");
|
||||
}
|
||||
//if (window.Worker) {
|
||||
// Engine._scriptWebWorker = new Worker("netscript/NetscriptWorker.js");
|
||||
//}
|
||||
|
||||
//Load, save, and delete buttons
|
||||
//Engine.Clickables.saveButton = document.getElementById("save");
|
||||
@ -313,6 +313,8 @@ var Engine = {
|
||||
|
||||
//Run main loop
|
||||
Engine.idleTimer();
|
||||
|
||||
runScriptsLoop();
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user