Added maxNumNodes to the hacknet API

This commit is contained in:
Olivier Gagnon 2021-03-07 16:03:21 -05:00
parent 58e38faad6
commit dabb5016fc
5 changed files with 14 additions and 2 deletions

@ -0,0 +1,8 @@
maxNumNodes() Netscript Function
=============================
.. js:function:: maxNumNodes()
:RAM cost: 0 GB
Returns the maximum number of Hacknet Nodes you can own.

@ -242,6 +242,7 @@ export let CONSTANTS: IMap<any> = {
* getCharacterInformation now additionally returns exp
* pid resets back to 1 when installing or destroying a BitNode.
* New '.ns' scripts start with a main function.
* hacknet.maxNumNodes returns the maximum number of hacknet nodes.
Misc.
* Fixed an issue where SF3 was listed as infinitly repeatable and SF12 as

@ -52,7 +52,7 @@ import {
purchaseHashUpgrade,
updateHashManagerCapacity,
} from "./Hacknet/HacknetHelpers";
import { HacknetServer } from "./Hacknet/HacknetServer";
import { HacknetServer, MaxNumberHacknetServers } from "./Hacknet/HacknetServer";
import { CityName } from "./Locations/data/CityNames";
import { LocationName } from "./Locations/data/LocationNames";
@ -392,6 +392,9 @@ function NetscriptFunctions(workerScript) {
numNodes : function() {
return Player.hacknetNodes.length;
},
maxNumNodes : function() {
return MaxNumberHacknetServers;
},
purchaseNode : function() {
return purchaseHacknet();
},

@ -103,7 +103,7 @@ let NetscriptFunctions =
// Hacknet Node API
"hacknet|numNodes|purchaseNode|getPurchaseNodeCost|getNodeStats|" +
"upgradeLevel|upgradeRam|upgradeCore|upgradeCache|getLevelUpgradeCost|" +
"getRamUpgradeCost|getCoreUpgradeCost|getCacheUpgradeCost|" +
"getRamUpgradeCost|getCoreUpgradeCost|getCacheUpgradeCost|maxNumNodes|" +
// Gang API
"gang|" +