Merge pull request #3192 from gianfun/check-corp-upgrade-before-purchase

Check before unlocking corp upgrade
This commit is contained in:
hydroflame 2022-03-20 21:27:21 -04:00 committed by GitHub
commit 04d45a1f0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -64,6 +64,9 @@ export function UnlockUpgrade(corporation: ICorporation, upgrade: CorporationUnl
if (corporation.funds < upgrade[1]) {
throw new Error("Insufficient funds");
}
if(corporation.unlockUpgrades[upgrade[0]] === 1){
throw new Error(`You have already unlocked the ${upgrade[2]} upgrade!`);
}
corporation.unlock(upgrade);
}