From 54cfb28bd6010a8fd777bd077f2adde74777ba0f Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 19 Sep 2021 11:28:44 -0500 Subject: [PATCH] Made it so by default, challenges can't be entered when complete --- src/components/features/Challenge.vue | 11 +++++++---- src/game/layers.ts | 4 +++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/features/Challenge.vue b/src/components/features/Challenge.vue index ef57ed0..38473d3 100644 --- a/src/components/features/Challenge.vue +++ b/src/components/features/Challenge.vue @@ -9,11 +9,15 @@ resetNotify: challenge.active, notify: challenge.active && challenge.canComplete, done: challenge.completed, + canStart: challenge.canStart, maxed: challenge.maxed }" >
- @@ -101,12 +105,11 @@ export default defineComponent({ min-height: 50px; width: 120px; border-radius: var(--border-radius); - cursor: pointer; box-shadow: none !important; background: transparent; } -.challenge.maxed button { - cursor: unset; +.challenge.canStart button { + cursor: pointer; } diff --git a/src/game/layers.ts b/src/game/layers.ts index e941fcb..6afb405 100644 --- a/src/game/layers.ts +++ b/src/game/layers.ts @@ -268,7 +268,9 @@ export function addLayer(layer: RawLayer, player?: Partial): void { setDefault(layer.challenges.data[id], "onComplete", undefined, false); setDefault(layer.challenges.data[id], "onEnter", undefined, false); setDefault(layer.challenges.data[id], "onExit", undefined, false); - setDefault(layer.challenges.data[id], "canStart", true); + setDefault(layer.challenges.data[id], "canStart", function() { + return Decimal.lt(this.completions, this.completionLimit); + }); setDefault(layer.challenges.data[id], "completionLimit", new Decimal(1)); setDefault(layer.challenges.data[id], "mark", function() { return Decimal.gt(this.completionLimit, 1) && this.maxed;