mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 20:25:45 +01:00
Added scp terminal command
This commit is contained in:
parent
66d311f9d8
commit
54bf26689f
@ -1,5 +1,5 @@
|
|||||||
CONSTANTS = {
|
CONSTANTS = {
|
||||||
Version: "0.16",
|
Version: "0.17",
|
||||||
|
|
||||||
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
//Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience
|
||||||
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
//and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then
|
||||||
|
@ -762,7 +762,46 @@ var Terminal = {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "scp":
|
case "scp":
|
||||||
//TODO
|
if (commandArray.length != 2) {
|
||||||
|
post("Incorrect usage of scp command. Usage: scp [scriptname] [destination hostname/ip]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var args = commandArray[1].split(" ");
|
||||||
|
if (args.length != 2) {
|
||||||
|
post("Incorrect usage of scp command. Usage: scp [scriptname] [destination hostname/ip]");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var scriptname = args[0];
|
||||||
|
var server = getServer(args[1]);
|
||||||
|
if (server == null) {
|
||||||
|
post("Invalid destination. " + args[1] + " not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var ip = server.ip;
|
||||||
|
|
||||||
|
//Check that a script with this filename does not already exist
|
||||||
|
for (var i = 0; i < server.scripts.length; ++i) {
|
||||||
|
if (scriptname == server.scripts[i].filename) {
|
||||||
|
post(server.hostname + " already contains a script named " + scriptname);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var currServ = Player.getCurrentServer();
|
||||||
|
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 = ip;
|
||||||
|
server.scripts.push(newScript);
|
||||||
|
post(scriptname + " copied over to " + server.hostname);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post("Script not found");
|
||||||
break;
|
break;
|
||||||
case "sudov":
|
case "sudov":
|
||||||
if (commandArray.length != 1) {
|
if (commandArray.length != 1) {
|
||||||
|
Loading…
Reference in New Issue
Block a user