From 192d36d42a72c2240512a4b48f08b51e2ba6cbfd Mon Sep 17 00:00:00 2001 From: Harley White Date: Thu, 29 Apr 2021 18:33:12 -0400 Subject: [PATCH] PrestigeNotify in subtabs --- changelog.md | 4 +++- docs/subtabs-and-microtabs.md | 2 +- js/Demo/demoLayers.js | 1 + js/utils.js | 17 +++++++++++++++-- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/changelog.md b/changelog.md index 87f0de5..c64f04a 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,6 @@ # The Modding Tree changelog: -## v2.4: Rationalized Edition +## v2.4: Rationalized Edition - - Completely reworked tooltips. Shift-click a node to force its tooltip to stay displayed. (And hopefully finally fixed flickering!) - Added text-input and slider components. - Added the ability to toggle respec confirmations. @@ -10,8 +10,10 @@ - You no longer need to supply 'rows' and 'cols' for any Big Features. - Node symbols can use HTML. - Added documentation for the respec button. +- Added prestigeNotify to subtabs, and prestigeNotify in subtabs also highlights the layer node. - The version number no longer contains special characters or irrational numbers. + # v2.π.1 - 4/7/21 - Fixed formatting for some larger numbers. - Upgrades will expand if there is too much text to display. diff --git a/docs/subtabs-and-microtabs.md b/docs/subtabs-and-microtabs.md index 14233b4..6b1fb34 100644 --- a/docs/subtabs-and-microtabs.md +++ b/docs/subtabs-and-microtabs.md @@ -50,7 +50,7 @@ Normal subtabs and microtab subtabs both use the same features: - unlocked(): **optional**. a function to determine if the button for this subtab should be visible. By default, a subtab is always unlocked. You can't use the "this" keyword in this function. -- shouldNotify(): **optional**, if true, the tab button will be highlighted to notify the player that there is something there. +- shouldNotify()/prestigeNotify(): **optional**, if true, the tab button will be highlighted to notify the player that there is something there. - embedLayer: **SIGNIFICANT**, the id of another layer. If you have this, it will override "content", "style" and "shouldNotify", instead displaying the entire layer in the subtab. \ No newline at end of file diff --git a/js/Demo/demoLayers.js b/js/Demo/demoLayers.js index 7005109..e2091aa 100644 --- a/js/Demo/demoLayers.js +++ b/js/Demo/demoLayers.js @@ -304,6 +304,7 @@ addLayer("c", { "h-line", "milestones", "blank", "upgrades", "challenges"], }, thingies: { + prestigeNotify: true, style() {return {'background-color': '#222222'}}, buttonStyle() {return {'border-color': 'orange'}}, content:[ diff --git a/js/utils.js b/js/utils.js index 682d46a..920d77e 100644 --- a/js/utils.js +++ b/js/utils.js @@ -219,7 +219,20 @@ function layOver(obj1, obj2) { function prestigeNotify(layer) { if (layers[layer].prestigeNotify) return layers[layer].prestigeNotify() - else if (tmp[layer].autoPrestige || tmp[layer].passiveGeneration) return false + + if (isPlainObject(tmp[layer].tabFormat)) { + for (subtab in tmp[layer].tabFormat){ + if (subtabResetNotify(layer, 'mainTabs', subtab)) + return true + } + } + for (family in tmp[layer].microtabs) { + for (subtab in tmp[layer].microtabs[family]){ + if (subtabResetNotify(layer, family, subtab)) + return true + } + } + if (tmp[layer].autoPrestige || tmp[layer].passiveGeneration) return false else if (tmp[layer].type == "static") return tmp[layer].canReset else if (tmp[layer].type == "normal") return (tmp[layer].canReset && (tmp[layer].resetGain.gte(player[layer].points.div(10)))) else return false @@ -244,7 +257,7 @@ function subtabResetNotify(layer, family, id) { if (family == "mainTabs") subtab = tmp[layer].tabFormat[id] else subtab = tmp[layer].microtabs[family][id] if (subtab.embedLayer) return tmp[subtab.embedLayer].prestigeNotify - else return false + else return subtab.prestigeNotify } function nodeShown(layer) {