From c421c57e56f77a2a3f62a2e6c5e21c640cd0d97f Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Mon, 3 May 2021 11:58:11 -0400 Subject: [PATCH] address comments. --- src/NetscriptFunctions.js | 2 +- src/Terminal.jsx | 54 +++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/src/NetscriptFunctions.js b/src/NetscriptFunctions.js index 41d47e99f..74d867f6c 100644 --- a/src/NetscriptFunctions.js +++ b/src/NetscriptFunctions.js @@ -1619,7 +1619,7 @@ function NetscriptFunctions(workerScript) { }, getBitNodeMultipliers: function() { updateDynamicRam("getBitNodeMultipliers", getRamCost("getBitNodeMultipliers")); - if (Player.bitNodeN !== 5 && SourceFileFlags[5] <= 0) { + if (SourceFileFlags[5] <= 0 && Player.bitNodeN !== 5) { throw makeRuntimeErrorMsg("getBitNodeMultipliers", "Requires Source-File 5 to run."); } let copy = Object.assign({}, BitNodeMultipliers); diff --git a/src/Terminal.jsx b/src/Terminal.jsx index 46085d14a..501a216bd 100644 --- a/src/Terminal.jsx +++ b/src/Terminal.jsx @@ -1388,35 +1388,33 @@ let Terminal = { try { if (commandArray.length < 2) { postError("Incorrect number of arguments. Usage: tail [script] [arg1] [arg2]..."); - } else { - if(typeof commandArray[1] === 'string') { - const scriptName = Terminal.getFilepath(commandArray[1]); - if (!isScriptFilename(scriptName)) { - postError("tail can only be called on .script, .ns, .js files, or by pid"); - return; - } - - // Get script arguments - const args = []; - for (let i = 2; i < commandArray.length; ++i) { - args.push(commandArray[i]); - } - - // Check that the script exists on this machine - const runningScript = findRunningScript(scriptName, args, s); - if (runningScript == null) { - postError("No such script exists"); - return; - } - logBoxCreate(runningScript); - } else { - const runningScript = findRunningScriptByPid(commandArray[1], Player.getCurrentServer()); - if (runningScript == null) { - postError("No such script exists"); - return; - } - logBoxCreate(runningScript); + } else if(typeof commandArray[1] === 'string') { + const scriptName = Terminal.getFilepath(commandArray[1]); + if (!isScriptFilename(scriptName)) { + postError("tail can only be called on .script, .ns, .js files, or by pid"); + return; } + + // Get script arguments + const args = []; + for (let i = 2; i < commandArray.length; ++i) { + args.push(commandArray[i]); + } + + // Check that the script exists on this machine + const runningScript = findRunningScript(scriptName, args, s); + if (runningScript == null) { + postError("No such script exists"); + return; + } + logBoxCreate(runningScript); + } else { + const runningScript = findRunningScriptByPid(commandArray[1], Player.getCurrentServer()); + if (runningScript == null) { + postError("No such script exists"); + return; + } + logBoxCreate(runningScript); } } catch(e) { Terminal.postThrownError(e);