All v0.30.0 Changes

This commit is contained in:
danielyxie
2017-10-09 23:56:48 -05:00
parent 0927c4251e
commit 04bfcc0f20
16 changed files with 1474 additions and 1092 deletions
+29
View File
@@ -38,6 +38,7 @@ function Server(ip=createRandomIp(), hostname="", organizationName="",
this.runningScripts = []; //Stores RunningScript objects
this.programs = [];
this.messages = [];
this.dir = 0; //new Directory(this, null, "");
/* Hacking information (only valid for "foreign" aka non-purchased servers) */
//Skill required to attempt a hack. Whether a hack is successful will be determined
@@ -763,6 +764,34 @@ function PrintAllServers() {
}
}
// Directory object (folders)
function Directory(server, parent, name) {
this.s = server; //Ref to server
this.p = parent; //Ref to parent directory
this.c = []; //Subdirs
this.n = name;
this.d = parent.d + 1; //We'll only have a maximum depth of 3 or something
this.scrs = []; //Holds references to the scripts in server.scripts
this.pgms = [];
this.msgs = [];
}
Directory.prototype.createSubdir = function(name) {
var subdir = new Directory(this.s, this, name);
}
Directory.prototype.getPath = function(name) {
var res = [];
var i = this;
while (i !== null) {
res.unshift(i.n, "/");
i = i.parent;
}
res.unshift("/");
return res.join("");
}
export {Server, AllServers, getServer, GetServerByHostname, loadAllServers,
AddToAllServers, processSingleServerGrowth, initForeignServers,
prestigeAllServers, prestigeHomeComputer};