From 8dd2cbe46680ea20a73571af11d8e1a7ded6d880 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 30 Apr 2023 13:17:04 -0500 Subject: [PATCH] Make upgrade.canPurchase return false when already bought --- src/features/upgrades/upgrade.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/features/upgrades/upgrade.ts b/src/features/upgrades/upgrade.ts index 3861c5e..9ff9b28 100644 --- a/src/features/upgrades/upgrade.ts +++ b/src/features/upgrades/upgrade.ts @@ -137,7 +137,9 @@ export function createUpgrade( 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)) {