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(() => {