mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 09:43:54 +01:00
Fixed bugs with new Netscript commands
This commit is contained in:
parent
77e6bdbfdc
commit
f92556e754
@ -184,7 +184,7 @@ background-color: #555;
|
||||
|
||||
.active-scripts-server-panel {
|
||||
margin: 0px 6px 6px 6px;
|
||||
padding: 6px;
|
||||
padding: 0px 6px 6px 6px;
|
||||
width: 55%;
|
||||
margin-left: 5%;
|
||||
display: none;
|
||||
|
@ -34,7 +34,7 @@ CONSTANTS = {
|
||||
|
||||
/* Script related things */
|
||||
//Time (ms) it takes to run one operation in Netscript.
|
||||
CodeInstructionRunTime: 750,
|
||||
CodeInstructionRunTime: 500,
|
||||
|
||||
//RAM Costs for different commands
|
||||
ScriptWhileRamCost: 0.2,
|
||||
@ -538,7 +538,7 @@ CONSTANTS = {
|
||||
"v0.20.0<br>" +
|
||||
"-Refactored Netscript Interpreter code. Operations in Netscript should now run significantly faster (Every operation " +
|
||||
"such as a variable assignment, a function call, a binary operator, getting a variable's value, etc. used to take up to several seconds, " +
|
||||
"now each one should only take 750 milliseconds). <br><br>" +
|
||||
"now each one should only take ~500 milliseconds). <br><br>" +
|
||||
"-Percentage money stolen when hacking lowered to compensate for faster script speeds<br><br>" +
|
||||
"-Hacking experience granted by grow() halved<br><br>" +
|
||||
"-Weaken() is now ~11% faster, but only grants 3 base hacking exp upon completion instead of 5 <br><br>" +
|
||||
@ -560,7 +560,7 @@ CONSTANTS = {
|
||||
"-Server growth no longer happens naturally<br><br>" +
|
||||
"-Servers now have a maximum limit to their money. This limit is 50 times it's starting money<br><br>" +
|
||||
"-Hacking now grants 10% less hacking experience<br><br>" +
|
||||
"-You can now edit scripts that are running<br><br>+ " +
|
||||
"-You can now edit scripts that are running<br><br>" +
|
||||
"-Augmentations cost ~11% more money and 25% more faction reputation<br><br>" +
|
||||
"v0.19.7<br>" +
|
||||
"-Added changelog to Options menu<br>" +
|
||||
@ -648,7 +648,7 @@ CONSTANTS = {
|
||||
"v0.20.0<br>" +
|
||||
"-Refactored Netscript Interpreter code. Operations in Netscript should now run significantly faster (Every operation " +
|
||||
"such as a variable assignment, a function call, a binary operator, getting a variable's value, etc. used to take up to several seconds, " +
|
||||
"now each one should only take 750 milliseconds). <br><br>" +
|
||||
"now each one should only take ~500 milliseconds). <br><br>" +
|
||||
"-Percentage money stolen when hacking lowered to compensate for faster script speeds<br><br>" +
|
||||
"-Hacking experience granted by grow() halved<br><br>" +
|
||||
"-Weaken() is now ~11% faster, but only grants 3 base hacking exp upon completion instead of 5 <br><br>" +
|
||||
@ -670,6 +670,6 @@ CONSTANTS = {
|
||||
"-Server growth no longer happens naturally<br><br>" +
|
||||
"-Servers now have a maximum limit to their money. This limit is 50 times it's starting money<br><br>" +
|
||||
"-Hacking now grants 10% less hacking experience<br><br>" +
|
||||
"-You can now edit scripts that are running<br><br>+ " +
|
||||
"-You can now edit scripts that are running<br><br>" +
|
||||
"-Augmentations cost ~11% more money and 25% more faction reputation<br><br>",
|
||||
}
|
@ -43,7 +43,6 @@ function addMessageToServer(msg, serverHostname) {
|
||||
|
||||
//Checks if any of the 'timed' messages should be sent
|
||||
function checkForMessagesToSend() {
|
||||
console.log("checkForMessagesToSend() called");
|
||||
var jumper0 = Messages[MessageFilenames.Jumper0];
|
||||
var jumper1 = Messages[MessageFilenames.Jumper1];
|
||||
var jumper2 = Messages[MessageFilenames.Jumper2];
|
||||
|
@ -280,15 +280,16 @@ function evaluate(exp, workerScript) {
|
||||
return reject(makeRuntimeRejectMsg(workerScript, "Invalid IP or hostname passed into kill() command"));
|
||||
}
|
||||
|
||||
for (var i = 0; i < server.runningScripts.length; ++i) {
|
||||
if (filename == server.runningScripts[i].filename) {
|
||||
killWorkerScript(filename, server.ip);
|
||||
workerScript.scriptRef.log("Killing " + scriptName + ". May take up to a few minutes for the scripts to die...");
|
||||
return resolve(true);
|
||||
}
|
||||
var res = killWorkerScript(filename, server.ip);
|
||||
if (res) {
|
||||
workerScript.scriptRef.log("Killing " + filename + ". May take up to a few minutes for the scripts to die...");
|
||||
return Promise.resolve(true);
|
||||
} else {
|
||||
workerScript.scriptRef.log("kill() failed. No such script "+ filename + " on " + server.hostname);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
workerScript.scriptRef.log("kill() failed. No such script "+ scriptName + " on " + server.hostname);
|
||||
return resolve(false);
|
||||
}).then(function(res) {
|
||||
resolve(res);
|
||||
}).catch(function(e) {
|
||||
reject(e);
|
||||
});
|
||||
@ -304,7 +305,7 @@ function evaluate(exp, workerScript) {
|
||||
workerScript.scriptRef.log("killall() failed. Invalid IP or hostname passed in: " + ip);
|
||||
return reject(makeRuntimeRejectMsg(workerScript, "Invalid IP or hostname passed into killall() command"));
|
||||
}
|
||||
workerScript.scriptRef.log("killall(): Killing all scrips on " + server.hostname);
|
||||
workerScript.scriptRef.log("killall(): Killing all scripts on " + server.hostname + ". May take a few minutes for the scripts to die");
|
||||
for (var i = server.runningScripts.length; i >= 0; --i) {
|
||||
killWorkerScript(server.runningScripts[i], server.ip);
|
||||
}
|
||||
@ -344,7 +345,7 @@ function evaluate(exp, workerScript) {
|
||||
}
|
||||
if (sourceScript == null) {
|
||||
workerScript.scriptRef.log(scriptname + " does not exist. scp() failed");
|
||||
return resolve(false);
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
//Overwrite script if it already exists
|
||||
@ -355,8 +356,7 @@ function evaluate(exp, workerScript) {
|
||||
var oldScript = destServer.scripts[i];
|
||||
oldScript.code = sourceScript.code;
|
||||
oldScript.ramUsage = sourceScript.ramUsage;
|
||||
resolve(true);
|
||||
return;
|
||||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,7 +368,10 @@ function evaluate(exp, workerScript) {
|
||||
newScript.server = destServer.ip;
|
||||
destServer.scripts.push(newScript);
|
||||
workerScript.scriptRef.log(scriptname + " copied over to " + destServer.hostname);
|
||||
return resolve(true);
|
||||
return Promise.resolve(true);
|
||||
return;
|
||||
}).then(function(res) {
|
||||
resolve(res);
|
||||
}).catch(function(e) {
|
||||
reject(e);
|
||||
});
|
||||
@ -431,7 +434,7 @@ function evaluate(exp, workerScript) {
|
||||
workerScript.scriptRef.log("getServerRequiredHackingLevel() failed. Invalid IP or hostname passed in: " + ip);
|
||||
return reject(makeRuntimeRejectMsg(workerScript, "Invalid IP or hostname passed into getServerRequiredHackingLevel() command"));
|
||||
}
|
||||
workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + formatNumber(server.requiredHackingSkill, 0) + " for " + server.hsostname);
|
||||
workerScript.scriptRef.log("getServerRequiredHackingLevel returned " + formatNumber(server.requiredHackingSkill, 0) + " for " + server.hostname);
|
||||
resolve(server.requiredHackingSkill);
|
||||
}, function(e) {
|
||||
reject(e);
|
||||
|
@ -111,6 +111,8 @@ function runScriptsLoop() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dialogBoxCreate("An unknown script died for an unknown reason. This is a bug please contact game dev");
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -152,8 +154,10 @@ function killWorkerScript(scriptName, serverIp) {
|
||||
for (var i = 0; i < workerScripts.length; i++) {
|
||||
if (workerScripts[i].name == scriptName && workerScripts[i].serverIp == serverIp) {
|
||||
workerScripts[i].env.stopFlag = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//Queues a script to be run
|
||||
|
Loading…
Reference in New Issue
Block a user