diff --git a/autopilot.js b/autopilot.js index 7a011508..7339e6bd 100644 --- a/autopilot.js +++ b/autopilot.js @@ -511,9 +511,6 @@ async function checkOnRunningScripts(ns, player) { // If we have SF4, but not level 3, instruct daemon.js to reserve additional home RAM if ((4 in unlockedSFs) && unlockedSFs[4] < 3) daemonArgs.push('--reserved-ram', 32 * ((unlockedSFs[4] ?? 0) == 2 ? 4 : 16)); - // Open the tail window if it's the start of a new BN. Especially useful to new players. - if(getTimeInBit) - daemonArgs.push('--tail'); } // Once stanek's gift is accepted, launch it once per reset before we launch daemon (Note: stanek's gift is auto-purchased by faction-manager.js on your first install) @@ -535,8 +532,11 @@ async function checkOnRunningScripts(ns, player) { daemonRelaunchMessage ??= `Relaunching daemon.js with new arguments since the current instance doesn't include all the args we want.`; log(ns, daemonRelaunchMessage); } - launchScriptHelper(ns, 'daemon.js', daemonArgs); + let daemonPid = launchScriptHelper(ns, 'daemon.js', daemonArgs); daemonStartTime = Date.now(); + // Open the tail window if it's the start of a new BN. Especially useful to new players. + if (getTimeInBitnode() < 1000 * 60 * 5 || homeRam == 8) // First 5 minutes, or BN1.1 + ns.tail(daemonPid); } // Default work for faction args we think are ideal for speed-running BNs @@ -839,7 +839,8 @@ function manageReservedMoney(ns, player, stocksValue) { function shouldWeKeepRunning(ns) { if (4 in unlockedSFs) return true; // If we have SF4 - run always - if (homeRam == 8) { + // If we've gotten daemon.js launched, but only have 8GB ram, we must shut down for now + if (homeRam == 8 && daemonStartTime > 0) { log(ns, `WARN: (not an actual warning, just trying to make this message stand out.)` + `\n` + '-'.repeat(100) + `\n\n Welcome to bitburner and thanks for using my scripts!` + @@ -848,7 +849,6 @@ function shouldWeKeepRunning(ns) { `\n purchase some home RAM (which you must do manually at a store like [alpha ent.] in the city),` + `\n\n Once you have more home ram, feel free to 'run ${ns.getScriptName()}' again!` + `\n\n` + '-'.repeat(100), true); - ns.tail(getFilePath('daemon.js')); return false; // Daemon.js needs more room to breath } // Otherwise, keep running diff --git a/daemon.js b/daemon.js index bc841d72..8a6113d1 100644 --- a/daemon.js +++ b/daemon.js @@ -570,7 +570,8 @@ async function tryRunTool(ns, tool) { } const args = funcResultOrValue(tool.args) || []; // Support either a static args array, or a function returning the args. const lowHomeRam = homeServer.totalRam(true) < 32; // Special-case. In early BN1.1, when home RAM is <32 GB, allow certain scripts to be run on any host - const runResult = lowHomeRam ? await arbitraryExecution(ns, tool, 1, args, backupServerName) : + const runResult = lowHomeRam ? + await arbitraryExecution(ns, tool, 1, args, allHostNames.includes(backupServerName) ? backupServerName : daemonHost) : await exec(ns, tool.name, daemonHost, tool.runOptions, ...args); if (runResult) { runningOnServer = await whichServerIsRunning(ns, tool.name, false); diff --git a/helpers.js b/helpers.js index 7749712c..22eb3a4e 100644 --- a/helpers.js +++ b/helpers.js @@ -661,7 +661,7 @@ export async function instanceCount(ns, onHost = "home", warn = true, tailOtherI log(ns, `WARNING: You cannot start multiple versions of this script (${scriptName}). Please shut down the other instance first.` + (tailOtherInstances ? ' (To help with this, a tail window for the other instance will be opened)' : ''), true, 'warning'); if (tailOtherInstances) // Tail all but the last pid, since it will belong to the current instance (which will be shut down) - otherInstances.slice(0, others.length - 1).forEach(pid => ns.tail(pid)); + otherInstances.slice(0, otherInstances.length - 1).forEach(pid => ns.tail(pid)); } return otherInstances.length; }