Added hacknet node api functions for spending hashes. Fixed several bugs with v0.46.0. Rebalanced hash upgrades. continued working on terminal directory implementation

This commit is contained in:
danielyxie
2019-04-05 02:08:41 -07:00
parent fb857642e8
commit 3241945452
30 changed files with 576 additions and 314 deletions
+2 -3
View File
@@ -151,13 +151,12 @@ export class HashManager {
*/
upgrade(upgName: string): boolean {
const upg = HashUpgrades[upgName];
const currLevel = this.upgrades[upgName];
if (upg == null || currLevel == null) {
if (upg == null) {
console.error(`Invalid Upgrade Name given to HashManager.upgrade(): ${upgName}`);
return false;
}
const cost = upg.getCost(currLevel);
const cost = this.getUpgradeCost(upgName);
if (this.hashes < cost) {
return false;