Make upgrade.canPurchase return false when already bought

This commit is contained in:
thepaperpilot 2023-04-30 13:17:04 -05:00
parent 3092fb91a9
commit 2a362a95c3

View file

@ -137,7 +137,9 @@ export function createUpgrade<T extends UpgradeOptions>(
upgrade.bought = bought;
Object.assign(upgrade, decoratedData);
upgrade.canPurchase = computed(() => requirementsMet(upgrade.requirements));
upgrade.canPurchase = computed(
() => !bought.value && requirementsMet(upgrade.requirements)
);
upgrade.purchase = function () {
const genericUpgrade = upgrade as GenericUpgrade;
if (!unref(genericUpgrade.canPurchase)) {