mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-05 23:27:55 +02:00
Added offline properties for Script object
This commit is contained in:
+18
-2
@@ -7,9 +7,21 @@ function Script() {
|
||||
//is executed every second (this may change)
|
||||
this.functionQueue = [];
|
||||
|
||||
this.code = "";
|
||||
this.ramUsage = 0;
|
||||
this.code = "";
|
||||
this.ramUsage = 0;
|
||||
|
||||
/* Properties to calculate offline progress. Only applies for infinitely looping scripts */
|
||||
|
||||
//Time it takes to execute one iteration of the entire script
|
||||
//Each function takes 1 second, plus hacking time plus and sleep commands
|
||||
this.executionTimeMillis = 0;
|
||||
|
||||
//Number of instructions ("lines") in the code. Any call ending in a ;
|
||||
//is considered one instruction. Used to calculate executionTime
|
||||
this.numInstructions = 0;
|
||||
|
||||
//Which servers are hacked in one iteration of the script. May contain duplicates
|
||||
this.serversHacked = [];
|
||||
}
|
||||
|
||||
//Execute the next function in the Script's function queue
|
||||
@@ -20,6 +32,10 @@ Script.prototype.executeNext() {
|
||||
(this.functionQueue.shift())();
|
||||
}
|
||||
|
||||
Script.prototype.setCode(code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/* Wrapper object that wraps a function with its arguments.
|
||||
* These objects are pushed onto a Script object's function queue.
|
||||
* The functions can be called with the standard () operator
|
||||
|
||||
Reference in New Issue
Block a user