diff --git a/src/NetscriptEvaluator.js b/src/NetscriptEvaluator.js index 2bb27c7a3..f9463adf2 100644 --- a/src/NetscriptEvaluator.js +++ b/src/NetscriptEvaluator.js @@ -801,36 +801,48 @@ function evaluate(exp, workerScript) { return; } - //Check that a script with this filename does not already exist - for (var i = 0; i < destServer.scripts.length; ++i) { - if (scriptname == destServer.scripts[i].filename) { - workerScript.scriptRef.log(destServer.hostname + " already contains a script named " + scriptname); - resolve(false); - return; - } - } - var currServ = getServer(workerScript.serverIp); if (currServ == null) { reject(makeRuntimeRejectMsg(workerScript, "Could not find server ip for this script. This is a bug please contact game developer")); return; } + + var sourceScript = null; for (var i = 0; i < currServ.scripts.length; ++i) { if (scriptname == currServ.scripts[i].filename) { - var newScript = new Script(); - newScript.filename = scriptname; - newScript.code = currServ.scripts[i].code; - newScript.ramUsage = currServ.scripts[i].ramUsage; - newScript.server = destServer.ip; - destServer.scripts.push(newScript); - workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname); + sourceScript = currServ.scripts[i]; + break; + } + } + if (sourceScript == null) { + workerScript.scriptRef.log(scriptname + " does not exist. scp() failed"); + resolve(false); + return; + } + + //Overwrite script if it already exists + for (var i = 0; i < destServer.scripts.length; ++i) { + if (scriptname == destServer.scripts[i].filename) { + workerScript.scriptRef.log("WARNING: " + scriptname + " already exists on " + destServer.hostname + " and it will be overwritten."); + workerScript.scriptRef.log(scriptname + " overwritten on " + destServer.hostname); + var oldScript = destServer.scripts[i]; + oldScript.code = sourceScript.code; + oldScript.ramUsage = sourceScript.ramUsage; resolve(true); return; } } - workerScript.scriptRef.log(scriptname + " does not exist. scp() failed"); - resolve(false); - + + //Create new script if it does not already exist + var newScript = new Script(); + newScript.filename = scriptname; + newScript.code = sourceScript.code; + newScript.ramUsage = sourceScript.ramUsage; + newScript.server = destServer.ip; + destServer.scripts.push(newScript); + workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname); + resolve(true); + return; }, function(e) { reject(e); }); diff --git a/src/NetscriptWorker.js b/src/NetscriptWorker.js index b7b786623..601442d07 100644 --- a/src/NetscriptWorker.js +++ b/src/NetscriptWorker.js @@ -33,6 +33,7 @@ function runScriptsLoop() { var ast = Parser(Tokenizer(InputStream(workerScripts[i].code))); //console.log(ast); } catch (e) { + console.log("Error parsing script: " + workerScripts[i].name); dialogBoxCreate("Syntax ERROR in " + workerScripts[i].name + ":
" + e); workerScripts[i].env.stopFlag = true; continue; diff --git a/src/Server.js b/src/Server.js index 8be912d96..a2891e299 100644 --- a/src/Server.js +++ b/src/Server.js @@ -573,9 +573,9 @@ initForeignServers = function() { var NetworkGroup3 = [OmegaSoftwareServer, PhantasyServer, SilverHelixServer, NeoNightclubServer]; var NetworkGroup4 = [CrushFitnessGymServer, NetLinkTechnologiesServer, CompuTekServer, TheHubServer, JohnsonOrthopedicsServer, NiteSecServer]; var NetworkGroup5 = [CatalystVenturesServer, SysCoreSecuritiesServer, SummitUniversityServer, ZBInstituteOfTechnologyServer, RothmanUniversityServer, TheBlackHandServer]; - var NetworkGroup6 = [LexoCorpServer, RhoConstructionServer, AlphaEnterprisesServer, AevumPoliceServer, MilleniumFitnessGymServer, CyberSecServer, NiteSecServer]; + var NetworkGroup6 = [LexoCorpServer, RhoConstructionServer, AlphaEnterprisesServer, AevumPoliceServer, MilleniumFitnessGymServer]; var NetworkGroup7 = [GlobalPharmaceuticalsServer, AeroCorpServer, GalacticCyberSystemsServer, SnapFitnessGymServer]; - var NetworkGroup8 = [DeltaOneServer, UnitaLifeGroupServer, OmniaCybersystemsServer, BitRunnersServer]; + var NetworkGroup8 = [DeltaOneServer, UnitaLifeGroupServer, OmniaCybersystemsServer]; var NetworkGroup9 = [ZeusMedicalServer, SolarisSpaceSystemsServer, UniversalEnergyServer, IcarusMicrosystemsServer, DefCommServer]; var NetworkGroup10 = [NovaMedicalServer, ZBDefenseServer, TaiYangDigitalServer, InfoCommServer]; var NetworkGroup11 = [AppliedEnergeticsServer, MicrodyneTechnologiesServer, TitanLabsServer, BitRunnersServer]; diff --git a/src/Terminal.js b/src/Terminal.js index 055f8d166..ef97c3a1e 100644 --- a/src/Terminal.js +++ b/src/Terminal.js @@ -384,7 +384,6 @@ var Terminal = { //Process any aliases command = substituteAliases(command); - console.log("command after alises: " + command); //Only split the first space var commandArray = command.split(" ");