Check before unlocking corp upgrade

This commit is contained in:
Gian P 2022-03-19 16:53:28 -03:00
parent f801dc6d8a
commit 8be65faf9f

@ -64,6 +64,9 @@ export function UnlockUpgrade(corporation: ICorporation, upgrade: CorporationUnl
if (corporation.funds < upgrade[1]) { if (corporation.funds < upgrade[1]) {
throw new Error("Insufficient funds"); 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); corporation.unlock(upgrade);
} }