From cdce13480e47f00b1e1e0feebc38215f36f3b769 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Wed, 15 Feb 2023 00:22:24 -0600 Subject: [PATCH] Remove references to purchasing for repeatable --- src/features/repeatable.tsx | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/src/features/repeatable.tsx b/src/features/repeatable.tsx index 55d29bf..5842429 100644 --- a/src/features/repeatable.tsx +++ b/src/features/repeatable.tsx @@ -47,7 +47,6 @@ export interface RepeatableOptions { small?: Computable; maximize?: Computable; display?: Computable; - onPurchase?: VoidFunction; } export interface BaseRepeatable { @@ -56,7 +55,6 @@ export interface BaseRepeatable { maxed: Ref; canClick: ProcessedComputable; onClick: VoidFunction; - purchase: VoidFunction; type: typeof RepeatableType; [Component]: typeof ClickableComponent; [GatherProps]: () => Record; @@ -139,23 +137,21 @@ export function createRepeatable( return currClasses; }); repeatable.canClick = computed(() => requirementsMet(repeatable.requirements)); - repeatable.onClick = repeatable.purchase = - repeatable.onClick ?? - repeatable.purchase ?? - function (this: GenericRepeatable) { - const genericRepeatable = repeatable as GenericRepeatable; - if (!unref(genericRepeatable.canClick)) { - return; - } - payRequirements( - repeatable.requirements, - unref(genericRepeatable.maximize) - ? maxRequirementsMet(genericRepeatable.requirements) - : 1 - ); - genericRepeatable.amount.value = Decimal.add(genericRepeatable.amount.value, 1); - genericRepeatable.onPurchase?.(); - }; + const onClick = repeatable.onClick; + repeatable.onClick = function (this: GenericRepeatable) { + const genericRepeatable = repeatable as GenericRepeatable; + if (!unref(genericRepeatable.canClick)) { + return; + } + payRequirements( + repeatable.requirements, + unref(genericRepeatable.maximize) + ? maxRequirementsMet(genericRepeatable.requirements) + : 1 + ); + genericRepeatable.amount.value = Decimal.add(genericRepeatable.amount.value, 1); + onClick?.(); + }; processComputable(repeatable as T, "display"); const display = repeatable.display; repeatable.display = jsx(() => {