mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 16:22:56 +02:00
recompile ns2 scripts if dependencies change
This commit is contained in:
+16
-2
@@ -31,6 +31,14 @@ export class Script {
|
||||
// This is only applicable for NetscriptJS
|
||||
module: any = "";
|
||||
|
||||
// The timestamp when when the script was last updated.
|
||||
updateTimestamp: number = 0;
|
||||
|
||||
// Only used with NS2 scripts; the list of dependency script filenames. This is constructed
|
||||
// whenever the script is first evaluated, and therefore may be out of date if the script
|
||||
// has been updated since it was last run.
|
||||
dependencies: string[] = [];
|
||||
|
||||
// Amount of RAM this Script requres to run
|
||||
ramUsage: number = 0;
|
||||
|
||||
@@ -85,11 +93,17 @@ export class Script {
|
||||
}
|
||||
this.filename = filenameElem!.value;
|
||||
this.server = serverIp;
|
||||
this.updateRamUsage(otherScripts);
|
||||
this.module = "";
|
||||
this.updateRamUsage(otherScripts);
|
||||
this.markUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
// Marks that this script has been updated. Causes recompilation of NS2 modules.
|
||||
markUpdated() {
|
||||
this.module = "";
|
||||
this.updateTimestamp = Date.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates and updates the script's RAM usage based on its code
|
||||
* @param {Script[]} otherScripts - Other scripts on the server. Used to process imports
|
||||
|
||||
Reference in New Issue
Block a user