Fixed bug with purchasing Hacknet Servers not updating hash capacity when done through Netscript

This commit is contained in:
danielyxie 2019-03-30 17:39:37 -07:00
parent c566c838be
commit b6b6d8e9fa
2 changed files with 2 additions and 2 deletions

@ -75,6 +75,7 @@ export function purchaseHacknet() {
}
/* END INTERACTIVE TUTORIAL */
const numOwned = Player.hacknetNodes.length;
if (hasHacknetServers()) {
const cost = getCostOfNextHacknetServer();
if (isNaN(cost)) {
@ -84,6 +85,7 @@ export function purchaseHacknet() {
if (!Player.canAfford(cost)) { return -1; }
Player.loseMoney(cost);
const server = createHacknetServer();
Player.hashManager.updateCapacity(Player);
return numOwned;
} else {
@ -95,7 +97,6 @@ export function purchaseHacknet() {
if (!Player.canAfford(cost)) { return -1; }
// Auto generate a name for the Node
const numOwned = Player.hacknetNodes.length;
const name = "hacknet-node-" + numOwned;
const node = new HacknetNode(name);
node.updateMoneyGainRate(Player);

@ -89,7 +89,6 @@ export class HacknetRoot extends React.Component {
const purchaseOnClick = () => {
if (purchaseHacknet() >= 0) {
this.recalculateTotalProduction();
Player.hashManager.updateCapacity(Player);
}
}