From eb890f0cfcd82e9db66912b906d36f8ad9049b98 Mon Sep 17 00:00:00 2001 From: Harley White Date: Thu, 17 Jun 2021 14:40:25 -0400 Subject: [PATCH] Fixed resetting --- changelog.md | 1 + js/Demo/demoMod.js | 2 +- js/Demo/layers/c.js | 2 +- js/game.js | 11 +++++++++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 95386f7..46eb8c0 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,7 @@ # v2.6.4.2 - 6/17/21 - Fixed a bug with the endgame screen. - Fixed hotkey-related crash. +- Fixed resetting not working correctly. # v2.6.4 - 6/17/21 - The game now autosaves before closing, if autosave is on. (Thank you to thepaperpilot for this!) diff --git a/js/Demo/demoMod.js b/js/Demo/demoMod.js index b04b735..63470e0 100644 --- a/js/Demo/demoMod.js +++ b/js/Demo/demoMod.js @@ -13,7 +13,7 @@ let modInfo = { // Set your version in num and name let VERSION = { - num: "2.6.4.2", + num: "2.6.4.3", name: "Fixed Reality", } diff --git a/js/Demo/layers/c.js b/js/Demo/layers/c.js index 46b3f24..4c9f1ac 100644 --- a/js/Demo/layers/c.js +++ b/js/Demo/layers/c.js @@ -204,7 +204,7 @@ addLayer("c", { }, }, doReset(resettingLayer){ // Triggers when this layer is being reset, along with the layer doing the resetting. Not triggered by lower layers resetting, but is by layers on the same row. - if(layers[resettingLayer].row > this.row) layerDataReset(this.layer, ["points"]) // This is actually the default behavior + if(layers[resettingLayer].row > this.row) layerDataReset(this.layer, ["points"]) }, layerShown() {return true}, // Condition for when layer appears on the tree automate() { diff --git a/js/game.js b/js/game.js index c944ec6..9ef37c6 100644 --- a/js/game.js +++ b/js/game.js @@ -3,7 +3,7 @@ var needCanvasUpdate = true; // Don't change this const TMT_VERSION = { - tmtNum: "2.6.4.2", + tmtNum: "2.6.4.3", tmtName: "Fixed Reality" } @@ -128,7 +128,6 @@ function canReset(layer) function rowReset(row, layer) { for (lr in ROW_LAYERS[row]){ if(layers[lr].doReset) { - if (!isNaN(row)) Vue.set(player[lr], "activeChallenge", null) // Exit challenges on any row reset on an equal or higher row run(layers[lr].doReset, layers[lr], layer) } @@ -145,7 +144,15 @@ function layerDataReset(layer, keep = []) { storedData[keep[thing]] = player[layer][keep[thing]] } + Vue.set(player[layer], "buyables", getStartBuyables(layer)) + Vue.set(player[layer], "clickables", getStartClickables(layer)) + Vue.set(player[layer], "challenges", getStartChallenges(layer)) + Vue.set(player[layer], "grid", getStartGrid(layer)) + layOver(player[layer], getStartLayerData(layer)) + player[layer].upgrades = [] + player[layer].milestones = [] + player[layer].achievements = [] for (thing in storedData) { player[layer][thing] =storedData[thing]