diff --git a/src/App.vue b/src/App.vue index d437be0..69a0f29 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,6 +4,7 @@ + diff --git a/src/components/index.js b/src/components/index.js index cff837e..b640729 100644 --- a/src/components/index.js +++ b/src/components/index.js @@ -43,6 +43,7 @@ import LayerProvider from './system/LayerProvider'; import LayerTab from './system/LayerTab'; import Microtab from './system/Microtab'; import Modal from './system/Modal'; +import NaNScreen from './system/NaNScreen'; import Nav from './system/Nav'; import Options from './system/Options'; import Resource from './system/Resource'; @@ -110,6 +111,7 @@ Vue.component(LayerProvider.name, LayerProvider); Vue.component(LayerTab.name, LayerTab); Vue.component(Microtab.name, Microtab); Vue.component(Modal.name, Modal); +Vue.component(NaNScreen.name, NaNScreen); Vue.component(Nav.name, Nav); Vue.component(Options.name, Options); Vue.component(Resource.name, Resource); diff --git a/src/components/system/GameOverScreen.vue b/src/components/system/GameOverScreen.vue index 6cadb5b..13446c0 100644 --- a/src/components/system/GameOverScreen.vue +++ b/src/components/system/GameOverScreen.vue @@ -13,15 +13,9 @@
Please check the Discord to discuss the game or to check for new content updates!

- @@ -33,7 +27,7 @@ + + diff --git a/src/store/game.js b/src/store/game.js index 3c1b09a..5a70013 100644 --- a/src/store/game.js +++ b/src/store/game.js @@ -107,6 +107,10 @@ function update() { if (store.getters.hasWon && !player.keepGoing) { return; } + // Stop here if the player had a NaN value + if (player.hasNaN) { + return; + } diff = new Decimal(diff).max(0); diff --git a/src/store/proxies.js b/src/store/proxies.js index f2b1356..2261101 100644 --- a/src/store/proxies.js +++ b/src/store/proxies.js @@ -33,7 +33,17 @@ const playerHandler = { return target[key]; }, - set(target, property, value) { + set(target, property, value, receiver) { + if (!player.hasNaN && value instanceof Decimal && (isNaN(value.sign) || isNaN(value.layer) || isNaN(value.mag))) { + player.autosave = false; + player.hasNaN = true; + player.NaNProperty = property; + player.NaNReceiver = receiver; + player.NaNPrevious = target[property]; + Vue.set(target, property, value); + console.error(`Attempted to set NaN value`, target, property); + throw 'Attempted to set NaN value. See above for details'; + } Vue.set(target, property, value); if (property === 'points') { if (target.best != undefined) { diff --git a/src/util/load.js b/src/util/load.js index 9faf04d..115d477 100644 --- a/src/util/load.js +++ b/src/util/load.js @@ -11,7 +11,6 @@ export function getInitialStore() { offlineProd: true, timePlayed: new Decimal(0), keepGoing: false, - hasNaN: false, lastTenTicks: [], showTPS: true, msDisplay: "all", @@ -32,6 +31,12 @@ export function getInitialStore() { ...layer.startData?.() }; return acc; - }, {}) + }, {}), + + // Values that don't get saved + hasNaN: false, + NaNProperty: "", + NaNReceiver: null, + NaNPrevious: null } }