2021-06-16 00:36:13 -05:00
|
|
|
<template>
|
2022-01-13 22:25:47 -06:00
|
|
|
<Modal v-model="hasNaN" v-bind="$attrs">
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
<template v-slot:header>
|
|
|
|
<div class="nan-modal-header">
|
|
|
|
<h2>NaN value detected!</h2>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template v-slot:body>
|
|
|
|
<div>
|
2022-01-13 22:25:47 -06:00
|
|
|
Attempted to assign "{{ path }}" to NaN<span v-if="previous">
|
|
|
|
{{ " " }}(previously {{ format(previous) }})</span
|
|
|
|
>. Auto-saving has been {{ autosave ? "enabled" : "disabled" }}. Check the console
|
|
|
|
for more details, and consider sharing it with the developers on discord.
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
</div>
|
|
|
|
<br />
|
|
|
|
<div>
|
|
|
|
<a :href="discordLink" class="nan-modal-discord-link">
|
2022-01-24 22:25:34 -06:00
|
|
|
<span class="material-icons nan-modal-discord">discord</span>
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
{{ discordName }}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<br />
|
2022-01-13 22:25:47 -06:00
|
|
|
<Toggle title="Autosave" v-model="autosave" />
|
|
|
|
<Toggle title="Pause game" v-model="isPaused" />
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
</template>
|
|
|
|
<template v-slot:footer>
|
|
|
|
<div class="nan-footer">
|
2022-01-24 22:23:30 -06:00
|
|
|
<button @click="savesManager?.open()" class="button">Open Saves Manager</button>
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
<button @click="setZero" class="button">Set to 0</button>
|
|
|
|
<button @click="setOne" class="button">Set to 1</button>
|
|
|
|
<button
|
2022-01-13 22:25:47 -06:00
|
|
|
@click="hasNaN = false"
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
class="button"
|
2022-01-13 22:25:47 -06:00
|
|
|
v-if="previous && Decimal.neq(previous, 0) && Decimal.neq(previous, 1)"
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
>
|
|
|
|
Set to previous
|
|
|
|
</button>
|
|
|
|
<button @click="ignore" class="button danger">Ignore</button>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Modal>
|
2022-01-13 22:25:47 -06:00
|
|
|
<SavesManager ref="savesManager" />
|
2021-06-16 00:36:13 -05:00
|
|
|
</template>
|
|
|
|
|
2022-01-13 22:25:47 -06:00
|
|
|
<script setup lang="ts">
|
2022-02-27 16:04:56 -06:00
|
|
|
import Modal from "@/components/Modal.vue";
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
import modInfo from "@/data/modInfo.json";
|
|
|
|
import player from "@/game/player";
|
2021-09-05 18:53:04 -05:00
|
|
|
import state from "@/game/state";
|
2022-01-13 22:25:47 -06:00
|
|
|
import Decimal, { DecimalSource, format } from "@/util/bignum";
|
2022-01-24 22:25:34 -06:00
|
|
|
import { ComponentPublicInstance, computed, ref, toRef } from "vue";
|
2022-02-27 16:04:56 -06:00
|
|
|
import Toggle from "./fields/Toggle.vue";
|
2022-01-13 22:25:47 -06:00
|
|
|
import SavesManager from "./SavesManager.vue";
|
2021-06-16 00:36:13 -05:00
|
|
|
|
2022-01-13 22:25:47 -06:00
|
|
|
const { discordName, discordLink } = modInfo;
|
|
|
|
const autosave = toRef(player, "autosave");
|
|
|
|
const hasNaN = toRef(state, "hasNaN");
|
2022-01-24 22:25:34 -06:00
|
|
|
const savesManager = ref<ComponentPublicInstance<typeof SavesManager> | null>(null);
|
2022-01-13 22:25:47 -06:00
|
|
|
|
|
|
|
const path = computed(() => state.NaNPath?.join("."));
|
|
|
|
const property = computed(() => state.NaNPath?.slice(-1)[0]);
|
|
|
|
const previous = computed<DecimalSource | null>(() => {
|
|
|
|
if (state.NaNReceiver && property.value) {
|
|
|
|
return state.NaNReceiver[property.value] as DecimalSource;
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
});
|
|
|
|
const isPaused = computed({
|
|
|
|
get() {
|
|
|
|
return player.devSpeed === 0;
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
},
|
2022-01-13 22:25:47 -06:00
|
|
|
set(value: boolean) {
|
|
|
|
player.devSpeed = value ? null : 0;
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
}
|
|
|
|
});
|
2022-01-13 22:25:47 -06:00
|
|
|
|
|
|
|
function setZero() {
|
|
|
|
if (state.NaNReceiver && property.value) {
|
|
|
|
state.NaNReceiver[property.value] = new Decimal(0);
|
|
|
|
state.hasNaN = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function setOne() {
|
|
|
|
if (state.NaNReceiver && property.value) {
|
|
|
|
state.NaNReceiver[property.value] = new Decimal(1);
|
|
|
|
state.hasNaN = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function ignore() {
|
|
|
|
if (state.NaNReceiver && property.value) {
|
|
|
|
state.NaNReceiver[property.value] = new Decimal(NaN);
|
|
|
|
state.hasNaN = false;
|
|
|
|
}
|
|
|
|
}
|
2021-06-16 00:36:13 -05:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
.nan-modal-header {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
padding: 10px 0;
|
2021-06-16 00:36:13 -05:00
|
|
|
margin-left: 10px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nan-footer {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
display: flex;
|
2021-06-16 00:36:13 -05:00
|
|
|
justify-content: flex-end;
|
|
|
|
}
|
|
|
|
|
|
|
|
.nan-footer button {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
margin: 0 10px;
|
2021-06-16 00:36:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.nan-modal-discord-link {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
2021-06-16 00:36:13 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
.nan-modal-discord {
|
First pass at typescript support
Oh man did this end up requiring a *ton* of other work as well.
There's still a few typing issues I still can't quite work out,
and others I'd like to improve when I have time. In fact, this version
doesn't even really work, it has a stack overflow error caused by
a tooltip for some reason have a tree inside it, which in turn has
another tooltip, etc. There's also 17 errors that I *really* feel like
shouldn't be there, but they are, and 113 warnings - mostly using !
to assert that things are non-null. Lots of work left to do, to sum up.
The reason I'm committing this now is because I really need to get to
work on my game jam, and since it won't use a tree or really many of
TMT-X's features, I can get away with using a broken engine :)
2021-08-16 23:30:54 -05:00
|
|
|
margin: 0;
|
|
|
|
margin-right: 4px;
|
2021-06-16 00:36:13 -05:00
|
|
|
}
|
|
|
|
</style>
|