1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2025-01-29 14:51:40 +00:00

Fixed resetting

This commit is contained in:
Harley White 2021-06-17 14:40:25 -04:00
parent 9570acb5e3
commit eb890f0cfc
4 changed files with 12 additions and 4 deletions

View file

@ -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!)

View file

@ -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",
}

View file

@ -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() {

View file

@ -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]