forked from profectus/Profectus
Make upgrade.canPurchase return false when already bought
This commit is contained in:
parent
04f14c17bd
commit
8dd2cbe466
1 changed files with 3 additions and 1 deletions
|
@ -137,7 +137,9 @@ export function createUpgrade<T extends UpgradeOptions>(
|
||||||
upgrade.bought = bought;
|
upgrade.bought = bought;
|
||||||
Object.assign(upgrade, decoratedData);
|
Object.assign(upgrade, decoratedData);
|
||||||
|
|
||||||
upgrade.canPurchase = computed(() => requirementsMet(upgrade.requirements));
|
upgrade.canPurchase = computed(
|
||||||
|
() => !bought.value && requirementsMet(upgrade.requirements)
|
||||||
|
);
|
||||||
upgrade.purchase = function () {
|
upgrade.purchase = function () {
|
||||||
const genericUpgrade = upgrade as GenericUpgrade;
|
const genericUpgrade = upgrade as GenericUpgrade;
|
||||||
if (!unref(genericUpgrade.canPurchase)) {
|
if (!unref(genericUpgrade.canPurchase)) {
|
||||||
|
|
Loading…
Reference in a new issue