Made it so by default, challenges can't be entered when complete

This commit is contained in:
thepaperpilot 2021-09-19 11:28:44 -05:00
parent 1acf01014f
commit 54cfb28bd6
2 changed files with 10 additions and 5 deletions

View file

@ -9,11 +9,15 @@
resetNotify: challenge.active,
notify: challenge.active && challenge.canComplete,
done: challenge.completed,
canStart: challenge.canStart,
maxed: challenge.maxed
}"
>
<div v-if="title"><component :is="title" /></div>
<button :style="{ backgroundColor: challenge.maxed ? null : buttonColor }" @click="toggle">
<button
:style="{ backgroundColor: challenge.canStart ? buttonColor : null }"
@click="toggle"
>
{{ buttonText }}
</button>
<component v-if="fullDisplay" :is="fullDisplay" />
@ -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;
}
</style>

View file

@ -268,7 +268,9 @@ export function addLayer(layer: RawLayer, player?: Partial<PlayerData>): 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;