softReset now accepts a callback script like installAugmentations

This commit is contained in:
Olivier Gagnon
2021-03-11 20:37:58 -05:00
parent 486d025572
commit cae28e2d25
3 changed files with 38 additions and 22 deletions
+1 -19
View File
@@ -2054,7 +2054,7 @@ function applyAugmentation(aug, reapply=false) {
}
}
function installAugmentations(cbScript=null) {
function installAugmentations() {
if (Player.queuedAugmentations.length == 0) {
dialogBoxCreate("You have not purchased any Augmentations to install!");
return false;
@@ -2074,24 +2074,6 @@ function installAugmentations(cbScript=null) {
"to install the following Augmentations:<br>" + augmentationList +
"<br>You wake up in your home...you feel different...");
prestigeAugmentation();
//Run a script after prestiging
if (cbScript && isString(cbScript)) {
var home = Player.getHomeComputer();
for (const script of home.scripts) {
if (script.filename === cbScript) {
const ramUsage = script.ramUsage;
const ramAvailable = home.maxRam - home.ramUsed;
if (ramUsage > ramAvailable) {
return; // Not enough RAM
}
const runningScriptObj = new RunningScript(script, []); // No args
runningScriptObj.threads = 1; // Only 1 thread
startWorkerScript(runningScriptObj, home);
}
}
}
}
function augmentationExists(name) {