Error calculating hacknet node earnings sets to 0 instead of throwing error

This commit is contained in:
danielyxie 2018-01-10 09:50:31 -06:00
parent f211e8856f
commit 281aad993f
2 changed files with 8 additions and 2 deletions

5
dist/bundle.js vendored

@ -44676,7 +44676,10 @@ function processAllHacknetNodeEarnings(numCycles) {
function processSingleHacknetNodeEarnings(numCycles, nodeObj) {
var cyclesPerSecond = 1000 / __WEBPACK_IMPORTED_MODULE_2__engine_js__["Engine"]._idleSpeed;
var earningPerCycle = nodeObj.moneyGainRatePerSecond / cyclesPerSecond;
if (isNaN(earningPerCycle)) {throw new Error("Calculated Earnings is not a number");}
if (isNaN(earningPerCycle)) {
console.log("ERROR: Hacknet Node Calculated earnings is NaN");
earningPerCycle = 0;
}
var totalEarnings = numCycles * earningPerCycle;
nodeObj.totalMoneyGenerated += totalEarnings;
nodeObj.onlineTimeSeconds += (numCycles * (__WEBPACK_IMPORTED_MODULE_2__engine_js__["Engine"]._idleSpeed / 1000));

@ -480,7 +480,10 @@ function processAllHacknetNodeEarnings(numCycles) {
function processSingleHacknetNodeEarnings(numCycles, nodeObj) {
var cyclesPerSecond = 1000 / Engine._idleSpeed;
var earningPerCycle = nodeObj.moneyGainRatePerSecond / cyclesPerSecond;
if (isNaN(earningPerCycle)) {throw new Error("Calculated Earnings is not a number");}
if (isNaN(earningPerCycle)) {
console.log("ERROR: Hacknet Node Calculated earnings is NaN");
earningPerCycle = 0;
}
var totalEarnings = numCycles * earningPerCycle;
nodeObj.totalMoneyGenerated += totalEarnings;
nodeObj.onlineTimeSeconds += (numCycles * (Engine._idleSpeed / 1000));