mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-30 01:47:33 +01:00
markUpdated() for Script
This commit is contained in:
parent
c485fdfa87
commit
1236ad252b
@ -1139,7 +1139,7 @@ function NetscriptFunctions(workerScript) {
|
||||
var oldScript = destServer.scripts[i];
|
||||
oldScript.code = sourceScript.code;
|
||||
oldScript.ramUsage = sourceScript.ramUsage;
|
||||
oldScript.module = "";
|
||||
oldScript.markUpdated();;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -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);
|
||||
|
@ -534,7 +534,7 @@ export function loadAllRunningScripts() {
|
||||
|
||||
// Reset modules on all scripts
|
||||
for (let i = 0; i < server.scripts.length; ++i) {
|
||||
server.scripts[i].module = "";
|
||||
server.scripts[i].markUpdated();
|
||||
}
|
||||
|
||||
if (skipScriptLoad) {
|
||||
|
@ -68,6 +68,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
|
||||
@ -86,7 +94,7 @@ export class Script {
|
||||
this.filename = filenameElem!.value;
|
||||
this.server = serverIp;
|
||||
this.updateRamUsage(otherScripts);
|
||||
this.module = "";
|
||||
this.markUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ export class BaseServer {
|
||||
let script = this.scripts[i];
|
||||
script.code = code;
|
||||
script.updateRamUsage(this.scripts);
|
||||
script.module = "";
|
||||
script.markUpdated();
|
||||
ret.overwritten = true;
|
||||
ret.success = true;
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user