Begone side effects

This commit is contained in:
thepaperpilot 2022-12-23 21:24:27 -06:00
parent 87fa404662
commit 2a2790e13e

View file

@ -123,9 +123,6 @@ const layer = createLayer(id, function (this: BaseLayer) {
)), )),
visibility: () => showIf(Decimal.lt(foundationProgress.value, computedMaxFoundation.value)), visibility: () => showIf(Decimal.lt(foundationProgress.value, computedMaxFoundation.value)),
canClick: () => { canClick: () => {
if (Decimal.gt(computedMaxFoundation.value, foundationProgress.value)){
foundationProgress.value = Decimal.min(0, computedMaxFoundation.value)
}
if (Decimal.lt(trees.logs.value, foundationConversion.nextAt.value)) { if (Decimal.lt(trees.logs.value, foundationConversion.nextAt.value)) {
return false; return false;
} }
@ -146,6 +143,12 @@ const layer = createLayer(id, function (this: BaseLayer) {
style: "width: 600px; min-height: unset" style: "width: 600px; min-height: unset"
})); }));
watchEffect(() => {
if (Decimal.lt(computedMaxFoundation.value, foundationProgress.value)) {
foundationProgress.value = Decimal.min(0, computedMaxFoundation.value);
}
});
const buildFoundationHK = createHotkey(() => ({ const buildFoundationHK = createHotkey(() => ({
key: "w", key: "w",
description: "Build foundation", description: "Build foundation",