mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2025-02-18 10:53:43 +01:00
Merge pull request #630 from jaguilar/ns2_recompile_when_script_write
Recompile scripts when updated via ns.write
This commit is contained in:
@ -1901,6 +1901,7 @@ function NetscriptFunctions(workerScript) {
|
||||
}
|
||||
mode === "w" ? script.code = data : script.code += data;
|
||||
script.updateRamUsage(server.scripts);
|
||||
script.markUpdated();
|
||||
} else {
|
||||
// Write to text file
|
||||
let txtFile = getTextFile(fn, server);
|
||||
|
@ -79,6 +79,14 @@ export class Script {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Marks this script as having been updated. It will be recompiled next time something tries
|
||||
* to exec it.
|
||||
*/
|
||||
markUpdated() {
|
||||
this.module = "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Save a script from the script editor
|
||||
* @param {string} code - The new contents of the script
|
||||
|
Reference in New Issue
Block a user