diff --git a/src/components/NaNScreen.vue b/src/components/NaNScreen.vue index 76a7b75..511d1b6 100644 --- a/src/components/NaNScreen.vue +++ b/src/components/NaNScreen.vue @@ -14,9 +14,12 @@
- + discord - {{ discordName }} + {{ discordName || "The Paper Pilot Community" }}

@@ -50,49 +53,51 @@ import state from "game/state"; import type { DecimalSource } from "util/bignum"; import Decimal, { format } from "util/bignum"; import type { ComponentPublicInstance } from "vue"; -import { computed, ref, toRef } from "vue"; +import { computed, ref, toRef, watch } from "vue"; import Toggle from "./fields/Toggle.vue"; import SavesManager from "./SavesManager.vue"; const { discordName, discordLink } = projInfo; -const autosave = toRef(player, "autosave"); +const autosave = ref(true); +const isPaused = ref(true); const hasNaN = toRef(state, "hasNaN"); const savesManager = ref | null>(null); -const path = computed(() => state.NaNPath?.join(".")); -const property = computed(() => state.NaNPath?.slice(-1)[0]); -const previous = computed(() => { - if (state.NaNReceiver && property.value != null) { - return state.NaNReceiver[property.value] as DecimalSource; - } - return null; -}); -const isPaused = computed({ - get() { - return player.devSpeed === 0; - }, - set(value: boolean) { - player.devSpeed = value ? null : 0; +watch(hasNaN, hasNaN => { + if (hasNaN) { + autosave.value = player.autosave; + isPaused.value = player.devSpeed === 0; + } else { + player.autosave = autosave.value; + player.devSpeed = isPaused.value ? 0 : null; } }); +const path = computed(() => state.NaNPath?.join(".")); +const previous = computed(() => { + if (state.NaNPersistent != null) { + return state.NaNPersistent.value; + } + return null; +}); + function setZero() { - if (state.NaNReceiver && property.value != null) { - state.NaNReceiver[property.value] = new Decimal(0); + if (state.NaNPersistent != null) { + state.NaNPersistent.value = new Decimal(0); state.hasNaN = false; } } function setOne() { - if (state.NaNReceiver && property.value != null) { - state.NaNReceiver[property.value] = new Decimal(1); + if (state.NaNPersistent) { + state.NaNPersistent.value = new Decimal(1); state.hasNaN = false; } } function ignore() { - if (state.NaNReceiver && property.value != null) { - state.NaNReceiver[property.value] = new Decimal(NaN); + if (state.NaNPersistent) { + state.NaNPersistent.value = new Decimal(NaN); state.hasNaN = false; } } diff --git a/src/components/SavesManager.vue b/src/components/SavesManager.vue index 37b4d5b..91edd40 100644 --- a/src/components/SavesManager.vue +++ b/src/components/SavesManager.vue @@ -59,11 +59,10 @@