From 2a2790e13e4ca2f47b7715740e456275996edd7a Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Fri, 23 Dec 2022 21:24:27 -0600 Subject: [PATCH] Begone side effects --- src/data/layers/workshop.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/data/layers/workshop.tsx b/src/data/layers/workshop.tsx index b550e2e..4a0401a 100644 --- a/src/data/layers/workshop.tsx +++ b/src/data/layers/workshop.tsx @@ -123,9 +123,6 @@ const layer = createLayer(id, function (this: BaseLayer) { )), visibility: () => showIf(Decimal.lt(foundationProgress.value, computedMaxFoundation.value)), canClick: () => { - if (Decimal.gt(computedMaxFoundation.value, foundationProgress.value)){ - foundationProgress.value = Decimal.min(0, computedMaxFoundation.value) - } if (Decimal.lt(trees.logs.value, foundationConversion.nextAt.value)) { return false; } @@ -146,6 +143,12 @@ const layer = createLayer(id, function (this: BaseLayer) { style: "width: 600px; min-height: unset" })); + watchEffect(() => { + if (Decimal.lt(computedMaxFoundation.value, foundationProgress.value)) { + foundationProgress.value = Decimal.min(0, computedMaxFoundation.value); + } + }); + const buildFoundationHK = createHotkey(() => ({ key: "w", description: "Build foundation",