From 6b9dc76f41803ec696e5a69d2d2a4faf3854c005 Mon Sep 17 00:00:00 2001 From: danielyxie Date: Fri, 11 May 2018 20:54:59 -0500 Subject: [PATCH] Fix bug where sometimes Active Scripts UI wouldnt fully update after an Augmentation reset. This most likely happened because the player has too many scripts running, and they all get added to task queue to get deleted --- dist/engine.bundle.js | 6 +++--- dist/tests.bundle.js | 6 +++--- src/ActiveScriptsUI.js | 4 ++-- src/NetscriptWorker.js | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dist/engine.bundle.js b/dist/engine.bundle.js index 811652824..7e8b34100 100644 --- a/dist/engine.bundle.js +++ b/dist/engine.bundle.js @@ -18521,7 +18521,7 @@ function prestigeWorkerScripts() { Object(_ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__["deleteActiveScriptsItem"])(workerScripts[i]); workerScripts[i].env.stopFlag = true; } - Object(_ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__["updateActiveScriptsItems"])(); //Force UI to update + Object(_ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__["updateActiveScriptsItems"])(5000); //Force UI to update workerScripts.length = 0; } @@ -55109,10 +55109,10 @@ function deleteActiveScriptsItem(workerscript) { } //Update the ActiveScriptsItems array -function updateActiveScriptsItems() { +function updateActiveScriptsItems(maxTasks=100) { //Run tasks that need to be done sequentially (adding items, creating/deleting server panels) //We'll limit this to 50 at a time in case someone decides to start a bunch of scripts all at once... - let numTasks = Math.min(100, ActiveScriptsTasks.length); + let numTasks = Math.min(maxTasks, ActiveScriptsTasks.length); for (let i = 0; i < numTasks; ++i) { let task = ActiveScriptsTasks.shift(); try { diff --git a/dist/tests.bundle.js b/dist/tests.bundle.js index 58195a455..1ea89124b 100644 --- a/dist/tests.bundle.js +++ b/dist/tests.bundle.js @@ -18521,7 +18521,7 @@ function prestigeWorkerScripts() { Object(_ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__["deleteActiveScriptsItem"])(workerScripts[i]); workerScripts[i].env.stopFlag = true; } - Object(_ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__["updateActiveScriptsItems"])(); //Force UI to update + Object(_ActiveScriptsUI_js__WEBPACK_IMPORTED_MODULE_0__["updateActiveScriptsItems"])(5000); //Force UI to update workerScripts.length = 0; } @@ -55109,10 +55109,10 @@ function deleteActiveScriptsItem(workerscript) { } //Update the ActiveScriptsItems array -function updateActiveScriptsItems() { +function updateActiveScriptsItems(maxTasks=100) { //Run tasks that need to be done sequentially (adding items, creating/deleting server panels) //We'll limit this to 50 at a time in case someone decides to start a bunch of scripts all at once... - let numTasks = Math.min(100, ActiveScriptsTasks.length); + let numTasks = Math.min(maxTasks, ActiveScriptsTasks.length); for (let i = 0; i < numTasks; ++i) { let task = ActiveScriptsTasks.shift(); try { diff --git a/src/ActiveScriptsUI.js b/src/ActiveScriptsUI.js index 4460bdfa4..ec5424947 100644 --- a/src/ActiveScriptsUI.js +++ b/src/ActiveScriptsUI.js @@ -182,10 +182,10 @@ function deleteActiveScriptsItem(workerscript) { } //Update the ActiveScriptsItems array -function updateActiveScriptsItems() { +function updateActiveScriptsItems(maxTasks=100) { //Run tasks that need to be done sequentially (adding items, creating/deleting server panels) //We'll limit this to 50 at a time in case someone decides to start a bunch of scripts all at once... - let numTasks = Math.min(100, ActiveScriptsTasks.length); + let numTasks = Math.min(maxTasks, ActiveScriptsTasks.length); for (let i = 0; i < numTasks; ++i) { let task = ActiveScriptsTasks.shift(); try { diff --git a/src/NetscriptWorker.js b/src/NetscriptWorker.js index 719ba7f60..2ae93a229 100644 --- a/src/NetscriptWorker.js +++ b/src/NetscriptWorker.js @@ -53,7 +53,7 @@ function prestigeWorkerScripts() { deleteActiveScriptsItem(workerScripts[i]); workerScripts[i].env.stopFlag = true; } - updateActiveScriptsItems(); //Force UI to update + updateActiveScriptsItems(5000); //Force UI to update workerScripts.length = 0; }