diff --git a/src/Constants.js b/src/Constants.js index 0414ed9fc..2a77bbeb4 100644 --- a/src/Constants.js +++ b/src/Constants.js @@ -523,7 +523,8 @@ let CONSTANTS = { * b1t_flum3.exe now takes significantly less time to create * Crimes commited through Singularity function no longer give half money/exp * Improved number formatting for Player 'work' actions (including crimes, etc.). These numbers should also adhere to locale settings now (by Kline-) - * The order that Augmentations are listed in (when purchasing from Faction and viewing your Augmentations) is now saved and persists when choosing different orders + * The order that Augmentations are listed in (when purchasing from Faction and viewing your Augmentations) is now saved and persists when choosing different orders + * getCharacterInformation() Singularity function now returns multiplier information (from Augmentations/Source Files) * Bug Fix: Calling print() in NetscriptJS no longer brings up the print dialog * Bug Fix: Fixed a bug that sometimes caused a blank black screen when destroying/resetting/switching BitNodes * Bug Fix: Netscript calls that throw errors will now no longer cause the 'concurrent calls' error if they are caught in the script. i.e. try/catch should now work properly in scripts @@ -531,6 +532,7 @@ let CONSTANTS = { * Bug Fix: Fixed a bug where calling the scp() Netscript function with invalid hostname/ips would throw an unclear error message * Bug Fix: Bladeburner API function getActionCountRemaining() should now work properly for BlackOps * Bug Fix: Black Ops can no longer be attempted out-of-order or without the required rank via Bladeburner API + * Bug Fix: Dynamic RAM Calculation now properly accounts for number of threads * RAM cost for basic Netscript functions added to documentation (by CBJamo) ` diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 757c603cb..275aa7b10 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -156,7 +156,14 @@ function NetscriptFunctions(workerScript) { var updateDynamicRam = function(fnName, ramCost) { if (workerScript.dynamicLoadedFns[fnName]) {return;} workerScript.dynamicLoadedFns[fnName] = true; - workerScript.dynamicRamUsage += ramCost; + + const threads = workerScript.scriptRef.threads; + if (typeof threads !== 'number') { + console.warn(`WorkerScript detected NaN for threadcount for ${workerScript.name} on ${workerScript.serverIp}`); + threads = 1; + } + + workerScript.dynamicRamUsage += (ramCost * threads); if (workerScript.dynamicRamUsage > 1.01 * workerScript.ramUsage) { throw makeRuntimeRejectMsg(workerScript, "Dynamic RAM usage calculated to be greater than initial RAM usage on fn: " + fnName + @@ -2684,7 +2691,7 @@ function NetscriptFunctions(workerScript) { company: Player.companyName, factions: Player.factions.slice(), jobTitle: companyPositionTitle, - mults: { + mult: { agility: Player.agility_mult, agilityExp: Player.agility_exp_mult, companyRep: Player.company_rep_mult,