unexport AllServers

This commit is contained in:
Olivier Gagnon
2021-10-07 16:04:04 -04:00
parent 1d488565c6
commit be29481689
27 changed files with 185 additions and 159 deletions

View File

@@ -7,22 +7,24 @@ import { CONSTANTS } from "../../Constants";
import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
import { Server } from "../../Server/Server";
import { BaseServer } from "../../Server/BaseServer";
import { HacknetServer } from "../../Hacknet/HacknetServer";
import { AddToAllServers, AllServers, createUniqueRandomIp } from "../../Server/AllServers";
import { AddToAllServers, createUniqueRandomIp } from "../../Server/AllServers";
import { getServer } from "../../Server/ServerHelpers";
import { SpecialServerIps } from "../../Server/SpecialServerIps";
export function hasTorRouter(this: IPlayer): boolean {
return SpecialServerIps.hasOwnProperty("Darkweb Server");
}
export function getCurrentServer(this: IPlayer): Server | HacknetServer {
const server = AllServers[this.currentServer];
export function getCurrentServer(this: IPlayer): BaseServer {
const server = getServer(this.currentServer);
if (server === null) throw new Error("somehow connected to a server that does not exist.");
return server;
}
export function getHomeComputer(this: IPlayer): Server {
const home = AllServers[this.homeComputer];
const home = getServer(this.homeComputer);
if (home instanceof Server) return home;
throw new Error("home computer was not a normal server");
}