From 797447faa6575f8fd2a10f3b3da24f6f661335d6 Mon Sep 17 00:00:00 2001 From: Acamaeda Date: Sun, 13 Dec 2020 22:23:12 -0500 Subject: [PATCH] 2.3.3 --- changelog.md | 5 +++++ docs/layer-features.md | 10 ++++++---- js/Demo/demoLayers.js | 1 - js/Demo/demoMod.js | 2 +- js/components.js | 8 ++++---- js/game.js | 23 ++++++++++++++++------- js/technical/layerSupport.js | 3 ++- js/utils.js | 10 ++++++---- style.css | 9 +++++++++ 9 files changed, 49 insertions(+), 22 deletions(-) diff --git a/changelog.md b/changelog.md index e00b5c2..cbb3369 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # The Modding Tree changelog: +## v2.3.3 - 12/13/20 +- Fixed the first node in a row always taking up space. +- layerShown is now optional. +- All prestige types can now use features for custom prestige types. + ## v2.3.2 - 12/13/20 - Fixed achievement/milestone popups. diff --git a/docs/layer-features.md b/docs/layer-features.md index 8360836..07b71e0 100644 --- a/docs/layer-features.md +++ b/docs/layer-features.md @@ -35,7 +35,8 @@ You can make almost any value dynamic by using a function in its place, includin - effectDescription: **optional**. A function that returns a description of this effect. If the text stays constant, it can just be a string. -- layerShown(): A function returning a bool which determines if this layer's node should be visible on the tree. It can also return "ghost", which will hide the layer, but its node will still take up space in the tree. +- layerShown(): **optional**, A function returning a bool which determines if this layer's node should be visible on the tree. It can also return "ghost", which will hide the layer, but its node will still take up space in the tree. + Defaults to true. - hotkeys: **optional**. An array containing information on any hotkeys associated with this layer: @@ -160,12 +161,13 @@ componentStyles: { ``` ## Custom Prestige type +(All of these can also be used by other prestige types) -- getResetGain(): **for custom prestige type**. Returns how many points you should get if you reset now. You can call `getResetGain(this.layer, useType = "static")` or similar to calculate what your gain would be under another prestige type (provided you have all of the required features in the layer). +- getResetGain(): **mostly for custom prestige type**. Returns how many points you should get if you reset now. You can call `getResetGain(this.layer, useType = "static")` or similar to calculate what your gain would be under another prestige type (provided you have all of the required features in the layer). -- getNextAt(canMax=false): **for custom prestige type**. Returns how many of the base currency you need to get to the next point. `canMax` is an optional variable used with Static-ish layers to differentiate between if it's looking for the first point you can reset at, or the requirement for any gain at all (Supporting both is good). You can also call `getNextAt(this.layer, canMax=false, useType = "static")` or similar to calculate what your next at would be under another prestige type (provided you have all of the required features in the layer). +- getNextAt(canMax=false): **mostly for custom prestige type**. Returns how many of the base currency you need to get to the next point. `canMax` is an optional variable used with Static-ish layers to differentiate between if it's looking for the first point you can reset at, or the requirement for any gain at all (Supporting both is good). You can also call `getNextAt(this.layer, canMax=false, useType = "static")` or similar to calculate what your next at would be under another prestige type (provided you have all of the required features in the layer). -- canReset(): **for custom prestige type**. Return true only if you have the resources required to do a prestige here. +- canReset(): **mostly for custom prestige type**. Return true only if you have the resources required to do a prestige here. - prestigeNotify(): **mostly for custom prestige types**, returns true if this layer should be subtly highlighted to indicate you can prestige for a meaningful gain. \ No newline at end of file diff --git a/js/Demo/demoLayers.js b/js/Demo/demoLayers.js index d54343f..1513239 100644 --- a/js/Demo/demoLayers.js +++ b/js/Demo/demoLayers.js @@ -484,7 +484,6 @@ addLayer("a", { color: "yellow", resource: "achievement power", row: "side", - layerShown() {return true}, tooltip() { // Optional, tooltip displays when the layer is locked return ("Achievements") }, diff --git a/js/Demo/demoMod.js b/js/Demo/demoMod.js index 68dc89b..7133b0d 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.2", + num: "2.3.3", name: "Cooler and Newer Edition", } diff --git a/js/components.js b/js/components.js index 3d523c5..2324b57 100644 --- a/js/components.js +++ b/js/components.js @@ -388,10 +388,10 @@ function loadVue() { key() {return this.$vnode.key} }, template: `
- - +
- -
+ + +
diff --git a/js/game.js b/js/game.js index 454b66e..f1fec0f 100644 --- a/js/game.js +++ b/js/game.js @@ -4,13 +4,17 @@ var gameEnded = false; // Don't change this const TMT_VERSION = { - tmtNum: "2.3.2", + tmtNum: "2.3.3", tmtName: "Cooler and Newer Edition" } function getResetGain(layer, useType = null) { let type = useType - if (!useType) type = tmp[layer].type + if (!useType){ + type = tmp[layer].type + if (layers[layer].getResetGain !== undefined) + return layers[layer].getResetGain() + } if(tmp[layer].type == "none") return new Decimal (0) if (tmp[layer].gainExp.eq(0)) return new Decimal(0) @@ -32,7 +36,12 @@ function getResetGain(layer, useType = null) { function getNextAt(layer, canMax=false, useType = null) { let type = useType - if (!useType) type = tmp[layer].type + if (!useType) { + type = tmp[layer].type + if (layers[layer].getNextAt !== undefined) + return layers[layer].getNextAt(canMax) + + } if(tmp[layer].type == "none") return new Decimal (Infinity) @@ -87,14 +96,14 @@ function shouldNotify(layer){ function canReset(layer) { - if(tmp[layer].type == "normal") + if (layers[layer].canReset!== undefined) + return run(layers[layer].canReset, layers[layer]) + else if(tmp[layer].type == "normal") return tmp[layer].baseAmount.gte(tmp[layer].requires) else if(tmp[layer].type== "static") return tmp[layer].baseAmount.gte(tmp[layer].nextAt) - if(tmp[layer].type == "none") + else return false - else - return run(layers[layer].canReset, layers[layer]) } function rowReset(row, layer) { diff --git a/js/technical/layerSupport.js b/js/technical/layerSupport.js index 57ad3e3..6a9433f 100644 --- a/js/technical/layerSupport.js +++ b/js/technical/layerSupport.js @@ -5,7 +5,7 @@ const decimalOne = new Decimal(1) const decimalNaN = new Decimal(NaN) function layerShown(layer){ - return layers[layer].layerShown(); + return tmp[layer].layerShown; } var LAYERS = Object.keys(layers); @@ -166,6 +166,7 @@ function setupLayer(layer){ if(layers[layer].softcapPower === undefined) layers[layer].softcapPower = new Decimal("0.5") if(layers[layer].displayRow === undefined) layers[layer].displayRow = layers[layer].row if(layers[layer].name === undefined) layers[layer].name = layer + if(layers[layer].layerShown === undefined) layers[layer].layerShown = true let row = layers[layer].row diff --git a/js/utils.js b/js/utils.js index efa86c5..91a11eb 100644 --- a/js/utils.js +++ b/js/utils.js @@ -59,7 +59,7 @@ function format(decimal, precision=2,) { function formatWhole(decimal) { decimal = new Decimal(decimal) if (decimal.gte(1e9)) return format(decimal, 2) - if (decimal.lte(0.95) && !decimal.eq(0)) return format(decimal, 2) + if (decimal.lte(0.98) && !decimal.eq(0)) return format(decimal, 2) return format(decimal, 0) } @@ -698,7 +698,7 @@ function subtabResetNotify(layer, family, id){ } function nodeShown(layer) { - if (tmp[layer].layerShown) return true + if (layerShown(layer)) return true switch(layer) { case "idk": return player.idk.unlocked @@ -788,7 +788,9 @@ function focused(x) { function prestigeButtonText(layer) { - if(tmp[layer].type == "normal") + if (layers[layer].prestigeButtonTest !== undefined) + return layers[layer].prestigeButtonText() + else if(tmp[layer].type == "normal") return `${ player[layer].points.lt(1e3) ? (tmp[layer].resetDescription !== undefined ? tmp[layer].resetDescription : "Reset for ") : ""}+${formatWhole(tmp[layer].resetGain)} ${tmp[layer].resource} ${tmp[layer].resetGain.lt(100) && player[layer].points.lt(1e3) ? `

Next at ${ (tmp[layer].roundUpCost ? formatWhole(tmp[layer].nextAt) : format(tmp[layer].nextAt))} ${ tmp[layer].baseResource }` : ""}` else if(tmp[layer].type== "static") return `${tmp[layer].resetDescription !== undefined ? tmp[layer].resetDescription : "Reset for "}+${formatWhole(tmp[layer].resetGain)} ${tmp[layer].resource}

${player[layer].points.lt(30) ? (tmp[layer].baseAmount.gte(tmp[layer].nextAt)&&(tmp[layer].canBuyMax !== undefined) && tmp[layer].canBuyMax?"Next:":"Req:") : ""} ${formatWhole(tmp[layer].baseAmount)} / ${(tmp[layer].roundUpCost ? formatWhole(tmp[layer].nextAtDisp) : format(tmp[layer].nextAtDisp))} ${ tmp[layer].baseResource } @@ -796,7 +798,7 @@ function prestigeButtonText(layer) else if(tmp[layer].type == "none") return "" else - return layers[layer].prestigeButtonText() + return "You need prestige button text" } function isFunction(obj) { diff --git a/style.css b/style.css index 688f074..adc941c 100644 --- a/style.css +++ b/style.css @@ -56,6 +56,15 @@ td { vertical-align: 0 } +.nodeRow { + display: flex !important; + flex-flow: row wrap; + justify-content: center; + align-items: center; + max-width: 100%; + margin: 0 auto; +} + h1, h2, h3, b, input { display: inline; font-family: "Lucida Console", "Courier New", monospace