2021-06-16 00:36:13 -05:00
|
|
|
<template>
|
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
|
|
|
<Modal :show="hasNaN" v-bind="$attrs">
|
|
|
|
<template v-slot:header>
|
|
|
|
<div class="nan-modal-header">
|
|
|
|
<h2>NaN value detected!</h2>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template v-slot:body>
|
|
|
|
<div>
|
|
|
|
Attempted to assign "{{ path }}" to NaN (previously {{ format(previous) }}).
|
|
|
|
Auto-saving has been {{ autosave ? "enabled" : "disabled" }}. Check the console for
|
|
|
|
more details, and consider sharing it with the developers on discord.
|
|
|
|
</div>
|
|
|
|
<br />
|
|
|
|
<div>
|
|
|
|
<a :href="discordLink" class="nan-modal-discord-link">
|
|
|
|
<img src="images/discord.png" class="nan-modal-discord" />
|
|
|
|
{{ discordName }}
|
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<br />
|
|
|
|
<Toggle title="Autosave" :value="autosave" @change="setAutosave" />
|
|
|
|
<Toggle title="Pause game" :value="paused" @change="togglePaused" />
|
|
|
|
</template>
|
|
|
|
<template v-slot:footer>
|
|
|
|
<div class="nan-footer">
|
|
|
|
<button @click="toggleSavesManager" class="button">
|
|
|
|
Open Saves Manager
|
|
|
|
</button>
|
|
|
|
<button @click="setZero" class="button">Set to 0</button>
|
|
|
|
<button @click="setOne" class="button">Set to 1</button>
|
|
|
|
<button
|
|
|
|
@click="setPrev"
|
|
|
|
class="button"
|
|
|
|
v-if="previous && previous.neq(0) && previous.neq(1)"
|
|
|
|
>
|
|
|
|
Set to previous
|
|
|
|
</button>
|
|
|
|
<button @click="ignore" class="button danger">Ignore</button>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</Modal>
|
|
|
|
<SavesManager :show="showSaves" @closeDialog="toggleSavesManager" />
|
2021-06-16 00:36:13 -05:00
|
|
|
</template>
|
|
|
|
|
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
|
|
|
<script lang="ts">
|
|
|
|
import modInfo from "@/data/modInfo.json";
|
|
|
|
import player from "@/game/player";
|
|
|
|
import Decimal, { format } from "@/util/bignum";
|
|
|
|
import { mapState } from "@/util/vue";
|
|
|
|
import { defineComponent } from "vue";
|
2021-06-16 00:36:13 -05:00
|
|
|
|
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
|
|
|
export default defineComponent({
|
|
|
|
name: "NaNScreen",
|
|
|
|
data() {
|
|
|
|
const { discordName, discordLink } = modInfo;
|
|
|
|
return { discordName, discordLink, format, showSaves: false };
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
...mapState(["hasNaN", "autosave"]),
|
|
|
|
path(): string | undefined {
|
|
|
|
return player.NaNPath?.join(".");
|
|
|
|
},
|
|
|
|
previous(): any {
|
|
|
|
if (player.NaNReceiver && this.property) {
|
|
|
|
return player.NaNReceiver[this.property];
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
},
|
|
|
|
paused() {
|
|
|
|
return player.devSpeed === 0;
|
|
|
|
},
|
|
|
|
property(): string | undefined {
|
|
|
|
return player.NaNPath?.slice(-1)[0];
|
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
setZero() {
|
|
|
|
if (player.NaNReceiver && this.property) {
|
|
|
|
player.NaNReceiver[this.property] = new Decimal(0);
|
|
|
|
player.hasNaN = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setOne() {
|
|
|
|
if (player.NaNReceiver && this.property) {
|
|
|
|
player.NaNReceiver[this.property] = new Decimal(1);
|
|
|
|
player.hasNaN = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setPrev() {
|
|
|
|
player.hasNaN = false;
|
|
|
|
},
|
|
|
|
ignore() {
|
|
|
|
if (player.NaNReceiver && this.property) {
|
|
|
|
player.NaNReceiver[this.property] = new Decimal(NaN);
|
|
|
|
player.hasNaN = false;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
setAutosave(autosave: boolean) {
|
|
|
|
player.autosave = autosave;
|
|
|
|
},
|
|
|
|
toggleSavesManager() {
|
|
|
|
this.showSaves = !this.showSaves;
|
|
|
|
},
|
|
|
|
togglePaused() {
|
|
|
|
player.devSpeed = this.paused ? 1 : 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
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
|
|
|
height: 2em;
|
|
|
|
margin: 0;
|
|
|
|
margin-right: 4px;
|
2021-06-16 00:36:13 -05:00
|
|
|
}
|
|
|
|
</style>
|