From 4f99695b0a44c63c60aa5902e4f8e1d274c368e2 Mon Sep 17 00:00:00 2001 From: Harley White Date: Sun, 17 Jan 2021 15:15:52 -0500 Subject: [PATCH] Fixed Decimals not being kept on reset --- changelog.md | 5 ++++- js/Demo/demoLayers.js | 2 +- js/components.js | 2 +- js/utils.js | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 7c2e8ba..3f10b25 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,8 @@ # The Modding Tree changelog: +## v2.3.6 - +- Fixed keeping Decimal values on reset. + ## v2.3.5 - 12/21/20 - Added resetTime, which tracks the time since a layer prestiged or was reset. - A layer node will be highlighted red if one of its subtabs is highlighted red. @@ -8,7 +11,7 @@ - Other minor fixes. ## v2.3.4 - 12/16/20 -- Added an node image feature. +- Added a node image feature. - Resource display now always shows the amount of the currency the layer's gain is based on. - Added spacing between tree nodes. - Another attempt to fix tooltip flickering. diff --git a/js/Demo/demoLayers.js b/js/Demo/demoLayers.js index 1513239..a7b6415 100644 --- a/js/Demo/demoLayers.js +++ b/js/Demo/demoLayers.js @@ -200,7 +200,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) // This is actually the default behavior + if(layers[resettingLayer].row > this.row) layerDataReset(this.layer, ["points"]) // This is actually the default behavior }, layerShown() {return true}, // Condition for when layer appears on the tree automate() { diff --git a/js/components.js b/js/components.js index a479ae5..ddf7b40 100644 --- a/js/components.js +++ b/js/components.js @@ -218,7 +218,7 @@ function loadVue() { Vue.component('main-display', { props: ['layer'], template: ` -
You have

{{formatWhole(player[layer].points)}}

{{tmp[layer].resource}},

+
You have

{{formatWhole(player[layer].points)}}

{{tmp[layer].resource}},

` }) diff --git a/js/utils.js b/js/utils.js index 8a61a6a..ab1c52f 100644 --- a/js/utils.js +++ b/js/utils.js @@ -663,7 +663,8 @@ function goBack() { function layOver(obj1, obj2) { for (let x in obj2) { - if (obj2[x] instanceof Object) layOver(obj1[x], obj2[x]); + if (obj2[x] instanceof Decimal) obj1[x] = new Decimal(obj2[x]) + else if (obj2[x] instanceof Object) layOver(obj1[x], obj2[x]); else obj1[x] = obj2[x]; } }