From 44145804083442d810f34777f010dfe9c5b79e33 Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Mon, 21 Dec 2020 22:09:33 -0500 Subject: [PATCH] 2.3.5 --- changelog.md | 9 ++++++++- docs/layer-features.md | 5 +++-- js/Demo/demoMod.js | 2 +- js/game.js | 26 ++++++++++++++++++++++++-- js/utils.js | 11 ++++++----- style.css | 2 +- 6 files changed, 43 insertions(+), 12 deletions(-) diff --git a/changelog.md b/changelog.md index dfd31ae..7c2e8ba 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,14 @@ # The Modding Tree changelog: +## 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. +- Fixed issues with keeping challenges, buyables, and clickables on reset. +- Improved the unlocking of custom layers. +- Other minor fixes. + ## v2.3.4 - 12/16/20 -- Added an image feature, which puts an image on a node. +- Added an 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/docs/layer-features.md b/docs/layer-features.md index 7b13acd..2e027ea 100644 --- a/docs/layer-features.md +++ b/docs/layer-features.md @@ -20,6 +20,7 @@ You can make almost any value dynamic by using a function in its place, includin - total: A Decimal, tracks total amount of main prestige currency. Always tracked, but only shown if you add it here. - best: A Decimal, tracks highest amount of main prestige currency. Always tracked, but only shown if you add it here. - unlockOrder: used to keep track of relevant layers unlocked before this one. + - resetTime: A number, time since this layer was last prestiged (or reset by another layer) - color: A color associated with this layer, used in many places. (A string in hex format with a #) @@ -44,7 +45,7 @@ You can make almost any value dynamic by using a function in its place, includin hotkeys: [ { key: "p", // What the hotkey button is. Use uppercase if it's combined with shift, or "ctrl+x" for holding down ctrl. - desc: "p: reset your points for prestige points", // The description of the hotkey that is displayed in the game's How To Play tab + description: "p: reset your points for prestige points", // The description of the hotkey that is displayed in the game's How To Play tab onPress() { if (player.p.unlocked) doReset("p") } } ] @@ -110,7 +111,7 @@ You can make almost any value dynamic by using a function in its place, includin - onPrestige(gain): **optional**. A function that triggers when this layer prestiges, just before you gain the currency. Can be used to have secondary resource gain on prestige, or to recalculate things or whatnot. -- resetDesc: **optional**. Use this to replace "Reset for " on the Prestige button with something else. +- resetDescription: **optional**. Use this to replace "Reset for " on the Prestige button with something else. - prestigeButtonText(): **sometimes required**. Use this to make the entirety of the text a Prestige button contains. Only required for custom layers, but usable by all types. diff --git a/js/Demo/demoMod.js b/js/Demo/demoMod.js index 772b8e2..c01c97a 100644 --- a/js/Demo/demoMod.js +++ b/js/Demo/demoMod.js @@ -11,7 +11,7 @@ let modInfo = { // Set your version in num and name let VERSION = { - num: "2.3.4", + num: "2.3.5", name: "Cooler and Newer Edition", } diff --git a/js/game.js b/js/game.js index a0b1d8f..ccd7f56 100644 --- a/js/game.js +++ b/js/game.js @@ -4,7 +4,7 @@ var gameEnded = false; // Don't change this const TMT_VERSION = { - tmtNum: "2.3.4", + tmtNum: "2.3.5", tmtName: "Cooler and Newer Edition" } @@ -87,6 +87,20 @@ function shouldNotify(layer){ if (player[layer].activeChallenge && canCompleteChallenge(layer, player[layer].activeChallenge)) { return true } + + if (isPlainObject(tmp[layer].tabFormat)) { + for (subtab in tmp[layer].tabFormat){ + if (subtabShouldNotify(layer, 'mainTabs', subtab)) + return true + } + } + + for (family in tmp[layer].microtabs) { + for (subtab in tmp[layer].microtabs[family]){ + if (subtabShouldNotify(layer, family, subtab)) + return true + } + } if (tmp[layer].shouldNotify){ return tmp[layer].shouldNotify } @@ -125,15 +139,19 @@ function layerDataReset(layer, keep = []) { if (player[layer][keep[thing]] !== undefined) 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)) layOver(player[layer], getStartLayerData(layer)) player[layer].upgrades = [] player[layer].milestones = [] + player[layer].achievements = [] player[layer].challenges = getStartChallenges(layer) resetBuyables(layer) + if (layers[layer].clickables && !player[layer].clickables) player[layer].clickables = getStartClickables(layer) - for (thing in storedData) { player[layer][thing] =storedData[thing] } @@ -207,6 +225,8 @@ function doReset(layer, force=false) { rowReset("side", layer) prevOnReset = undefined + player[layer].resetTime = 0 + updateTemp() updateTemp() } @@ -315,6 +335,7 @@ function gameLoop(diff) { for (x = 0; x <= maxRow; x++){ for (item in TREE_LAYERS[x]) { let layer = TREE_LAYERS[x][item] + player[layer].resetTime += diff if (tmp[layer].passiveGeneration) generatePoints(layer, diff*tmp[layer].passiveGeneration); if (layers[layer].update) layers[layer].update(diff); } @@ -323,6 +344,7 @@ function gameLoop(diff) { for (row in OTHER_LAYERS){ for (item in OTHER_LAYERS[row]) { let layer = OTHER_LAYERS[row][item] + player[layer].resetTime += diff if (tmp[layer].passiveGeneration) generatePoints(layer, diff*tmp[layer].passiveGeneration); if (layers[layer].update) layers[layer].update(diff); } diff --git a/js/utils.js b/js/utils.js index 26a55b9..8a61a6a 100644 --- a/js/utils.js +++ b/js/utils.js @@ -148,6 +148,7 @@ function getStartLayerData(layer){ if (layerdata.unlocked === undefined) layerdata.unlocked = true if (layerdata.total === undefined) layerdata.total = new Decimal(0) if (layerdata.best === undefined) layerdata.best = new Decimal(0) + if (layerdata.resetTime === undefined) layerdata.resetTime = 0 layerdata.buyables = getStartBuyables(layer) if(layerdata.clickables == undefined) layerdata.clickables = getStartClickables(layer) @@ -684,8 +685,8 @@ function subtabShouldNotify(layer, family, id){ let subtab = {} if (family == "mainTabs") subtab = tmp[layer].tabFormat[id] else subtab = tmp[layer].microtabs[family][id] - if (player.subtabs[layer][family] === id) return false - else if (subtab.embedLayer) return tmp[subtab.embedLayer].notify + + if (subtab.embedLayer) return tmp[subtab.embedLayer].notify else return subtab.shouldNotify } @@ -709,7 +710,7 @@ function nodeShown(layer) { function layerunlocked(layer) { if (tmp[layer] && tmp[layer].type == "none") return (player[layer].unlocked) - return LAYERS.includes(layer) && (player[layer].unlocked || (tmp[layer].baseAmount.gte(tmp[layer].requires) && tmp[layer].layerShown)) + return LAYERS.includes(layer) && (player[layer].unlocked || (tmp[layer].canReset && tmp[layer].layerShown)) } function keepGoing() { @@ -725,7 +726,7 @@ function toNumber(x) { function updateMilestones(layer){ for (id in layers[layer].milestones){ - if (!(player[layer].milestones.includes(id)) && layers[layer].milestones[id].done()){ + if (!(hasMilestone(layer, id)) && layers[layer].milestones[id].done()){ player[layer].milestones.push(id) if (tmp[layer].milestonePopups || tmp[layer].milestonePopups === undefined) doPopup("milestone", tmp[layer].milestones[id].requirementDescription, "Milestone Gotten!", 3, tmp[layer].color); } @@ -734,7 +735,7 @@ function updateMilestones(layer){ function updateAchievements(layer){ for (id in layers[layer].achievements){ - if (isPlainObject(layers[layer].achievements[id]) && !(player[layer].achievements.includes(id)) && layers[layer].achievements[id].done()) { + if (isPlainObject(layers[layer].achievements[id]) && !(hasAchievement(layer, id)) && layers[layer].achievements[id].done()) { player[layer].achievements.push(id) if (layers[layer].achievements[id].onComplete) layers[layer].achievements[id].onComplete() if (tmp[layer].achievementPopups || tmp[layer].achievementPopups === undefined) doPopup("achievement", tmp[layer].achievements[id].name, "Achievement Gotten!", 3, tmp[layer].color); diff --git a/style.css b/style.css index c618f1a..541373f 100644 --- a/style.css +++ b/style.css @@ -214,7 +214,7 @@ h1, h2, h3, b, input { margin: 5px; border-radius: 10px; border: 2px solid; - border-color: rgba(0, 0, 0, 0.125); + color: var(--color); }