mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +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:
commit
6a3ffff3ad
@ -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
|
||||
@ -96,7 +104,7 @@ export class Script {
|
||||
}
|
||||
this.filename = filenameElem!.value;
|
||||
this.server = serverIp;
|
||||
this.updateRamUsage(otherScripts);
|
||||
this.updateRamUsage(otherScripts);
|
||||
this.markUpdated();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user