diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 5fef44888..5b6f6bb8d 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -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); diff --git a/src/Script/Script.ts b/src/Script/Script.ts index 3b9df8135..6e11fd08b 100644 --- a/src/Script/Script.ts +++ b/src/Script/Script.ts @@ -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(); } }