mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
getServer of hacknet doesn't return undefined
This commit is contained in:
parent
dea8abef1d
commit
11ba8c91be
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1334,15 +1334,24 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
|
|||||||
getServer: function (hostname: any = workerScript.hostname): any {
|
getServer: function (hostname: any = workerScript.hostname): any {
|
||||||
updateDynamicRam("getServer", getRamCost("getServer"));
|
updateDynamicRam("getServer", getRamCost("getServer"));
|
||||||
const server = safeGetServer(hostname, "getServer");
|
const server = safeGetServer(hostname, "getServer");
|
||||||
const copy = Object.assign({}, server);
|
const copy = Object.assign({}, server) as any;
|
||||||
// These fields should be hidden.
|
// These fields should be hidden.
|
||||||
copy.contracts = [];
|
copy.contracts = undefined;
|
||||||
copy.messages = [];
|
copy.messages = undefined;
|
||||||
copy.runningScripts = [];
|
copy.runningScripts = undefined;
|
||||||
copy.scripts = [];
|
copy.scripts = undefined;
|
||||||
copy.textFiles = [];
|
copy.textFiles = undefined;
|
||||||
copy.programs = [];
|
copy.programs = undefined;
|
||||||
copy.serversOnNetwork = [];
|
copy.serversOnNetwork = undefined;
|
||||||
|
if (!copy.baseDifficulty) copy.baseDifficulty = 0;
|
||||||
|
if (!copy.hackDifficulty) copy.hackDifficulty = 0;
|
||||||
|
if (!copy.minDifficulty) copy.minDifficulty = 0;
|
||||||
|
if (!copy.moneyAvailable) copy.moneyAvailable = 0;
|
||||||
|
if (!copy.moneyMax) copy.moneyMax = 0;
|
||||||
|
if (!copy.numOpenPortsRequired) copy.numOpenPortsRequired = 0;
|
||||||
|
if (!copy.openPortCount) copy.openPortCount = 0;
|
||||||
|
if (!copy.requiredHackingSkill) copy.requiredHackingSkill = 0;
|
||||||
|
if (!copy.serverGrowth) copy.serverGrowth = 0;
|
||||||
return copy;
|
return copy;
|
||||||
},
|
},
|
||||||
getServerMoneyAvailable: function (hostname: any): any {
|
getServerMoneyAvailable: function (hostname: any): any {
|
||||||
|
7
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
7
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -4842,13 +4842,12 @@ export interface NS extends Singularity {
|
|||||||
deleteServer(host: string): boolean;
|
deleteServer(host: string): boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array with either the hostnames or IPs of all of the servers you have purchased.
|
* Returns an array with the hostnames of all of the servers you have purchased.
|
||||||
*
|
*
|
||||||
* @remarks 2.25 GB
|
* @remarks 2.25 GB
|
||||||
* @param hostnameMode - Optional. Defaults to true. Returns hostnames if true, and IPs if false.
|
* @returns Returns an array with the hostnames of all of the servers you have purchased.
|
||||||
* @returns Returns an array with either the hostnames or IPs of all of the servers you have purchased.
|
|
||||||
*/
|
*/
|
||||||
getPurchasedServers(hostnameMode?: boolean): string[];
|
getPurchasedServers(): string[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the maximum number of servers you can purchase.
|
* Returns the maximum number of servers you can purchase.
|
||||||
|
Loading…
Reference in New Issue
Block a user