mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-19 12:45:45 +01:00
Merge pull request #350 from hydroflame/fix-server-used-ram
fixed ramUsed wrong calculation
This commit is contained in:
commit
e0ef2eae7a
@ -164,8 +164,17 @@ function runScriptsLoop() {
|
||||
var ip = workerScripts[i].serverIp;
|
||||
var name = workerScripts[i].name;
|
||||
|
||||
//Free RAM
|
||||
AllServers[ip].ramUsed -= workerScripts[i].ramUsage;
|
||||
//recalculate ram used
|
||||
AllServers[ip].ramUsed = 0;
|
||||
for(let j = 0; j < workerScripts.length; j++) {
|
||||
if(workerScripts[j].serverIp !== ip) {
|
||||
continue
|
||||
}
|
||||
if(j === i) { // not this one
|
||||
continue
|
||||
}
|
||||
AllServers[ip].ramUsed += workerScripts[j].ramUsage;
|
||||
}
|
||||
|
||||
//Delete script from Active Scripts
|
||||
deleteActiveScriptsItem(workerScripts[i]);
|
||||
|
Loading…
Reference in New Issue
Block a user