mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-23 22:52:29 +01:00
Merged and updated top command implementation
This commit is contained in:
parent
a1943ce1c0
commit
147a7393c5
@ -901,6 +901,9 @@ CONSTANTS = {
|
||||
"-You can now see what an Augmentation does and its price even while its locked<br><br>",
|
||||
|
||||
LatestUpdate:
|
||||
"v0.24.1<br>" +
|
||||
|
||||
"-'top' Terminal command implemented courtesy of Github user LTCNugget<br><br>" +
|
||||
"v0.24.0<br>" +
|
||||
"-Players now have HP, which is displayed in the top right. To regain HP, visit the hospital. Currently " +
|
||||
"the only way to lose HP is through infiltration<br>" +
|
||||
|
@ -1043,11 +1043,9 @@ var Terminal = {
|
||||
post("Script Threads RAM Usage");
|
||||
|
||||
var currRunningScripts = Player.getCurrentServer().runningScripts;
|
||||
var currScripts = Player.getCurrentServer().scripts;
|
||||
//Iterate through scripts on current server
|
||||
for(var i = 0; i < currScripts.length; i++) {
|
||||
if(currRunningScripts.includes(currScripts[i].filename)) { //If the script is running
|
||||
var script = currScripts[i];
|
||||
for(var i = 0; i < currRunningScripts.length; i++) {
|
||||
var script = currRunningScripts[i];
|
||||
|
||||
//Calculate name padding
|
||||
var numSpacesScript = 26 - script.filename.length; //26 -> width of name column
|
||||
@ -1058,12 +1056,10 @@ var Terminal = {
|
||||
var spacesThread = Array(numSpacesThread+1).join(" ");
|
||||
|
||||
//Calculate and transform RAM usage
|
||||
var ramUsage = script.ramUsage * script.threads * Math.pow(1.02, script.threads - 1);
|
||||
ramUsage = ramUsage + "GB";
|
||||
ramUsage = (script.scriptRef.ramUsage * script.threads) + "GB";
|
||||
|
||||
var entry = [script.filename, spacesScript, script.threads, spacesThread, ramUsage];
|
||||
post(entry.join(""));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "unalias":
|
||||
|
Loading…
Reference in New Issue
Block a user