mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-24 07:02:26 +01:00
split hacknet node from server in name, with SF9 (#327)
This commit is contained in:
parent
80061b1f81
commit
ac8ea6b5ef
src
@ -65,7 +65,7 @@ export function purchaseHacknet(): number {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Auto generate a name for the Node
|
// Auto generate a name for the Node
|
||||||
const name = "hacknet-node-" + numOwned;
|
const name = hasHacknetServers() ? `hacknet-server-${numOwned}` : `hacknet-node-${numOwned}`;
|
||||||
const node = new HacknetNode(name, Player.mults.hacknet_node_money);
|
const node = new HacknetNode(name, Player.mults.hacknet_node_money);
|
||||||
|
|
||||||
Player.loseMoney(cost, "hacknet_expenses");
|
Player.loseMoney(cost, "hacknet_expenses");
|
||||||
|
@ -9,6 +9,7 @@ import { BaseServer } from "../../Server/BaseServer";
|
|||||||
import { HacknetServer } from "../../Hacknet/HacknetServer";
|
import { HacknetServer } from "../../Hacknet/HacknetServer";
|
||||||
import { GetServer, AddToAllServers, createUniqueRandomIp } from "../../Server/AllServers";
|
import { GetServer, AddToAllServers, createUniqueRandomIp } from "../../Server/AllServers";
|
||||||
import { SpecialServers } from "../../Server/data/SpecialServers";
|
import { SpecialServers } from "../../Server/data/SpecialServers";
|
||||||
|
import { hasHacknetServers } from "../../Hacknet/HacknetHelpers";
|
||||||
|
|
||||||
export function hasTorRouter(this: PlayerObject): boolean {
|
export function hasTorRouter(this: PlayerObject): boolean {
|
||||||
return this.getHomeComputer().serversOnNetwork.includes(SpecialServers.DarkWeb);
|
return this.getHomeComputer().serversOnNetwork.includes(SpecialServers.DarkWeb);
|
||||||
@ -44,7 +45,7 @@ export function getUpgradeHomeCoresCost(this: PlayerObject): number {
|
|||||||
|
|
||||||
export function createHacknetServer(this: PlayerObject): HacknetServer {
|
export function createHacknetServer(this: PlayerObject): HacknetServer {
|
||||||
const numOwned = this.hacknetNodes.length;
|
const numOwned = this.hacknetNodes.length;
|
||||||
const name = `hacknet-node-${numOwned}`;
|
const name = hasHacknetServers() ? `hacknet-server-${numOwned}` : `hacknet-node-${numOwned}`;
|
||||||
const server = new HacknetServer({
|
const server = new HacknetServer({
|
||||||
adminRights: true,
|
adminRights: true,
|
||||||
hostname: name,
|
hostname: name,
|
||||||
|
@ -59,7 +59,7 @@ export class Server extends BaseServer {
|
|||||||
super(params);
|
super(params);
|
||||||
|
|
||||||
// "hacknet-node-X" hostnames are reserved for Hacknet Servers
|
// "hacknet-node-X" hostnames are reserved for Hacknet Servers
|
||||||
if (this.hostname.startsWith("hacknet-node-")) {
|
if (this.hostname.startsWith("hacknet-node-" || "hacknet-server-")) {
|
||||||
this.hostname = createRandomString(10);
|
this.hostname = createRandomString(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user