1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-21 16:13:55 +00:00
This commit is contained in:
Acamaeda 2020-12-13 22:23:12 -05:00
parent e148df8e00
commit 797447faa6
9 changed files with 49 additions and 22 deletions

View file

@ -1,5 +1,10 @@
# The Modding Tree changelog: # 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 ## v2.3.2 - 12/13/20
- Fixed achievement/milestone popups. - Fixed achievement/milestone popups.

View file

@ -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. - 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: - hotkeys: **optional**. An array containing information on any hotkeys associated with this layer:
@ -160,12 +161,13 @@ componentStyles: {
``` ```
## Custom Prestige type ## 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 - prestigeNotify(): **mostly for custom prestige types**, returns true if this layer should be subtly highlighted to indicate you
can prestige for a meaningful gain. can prestige for a meaningful gain.

View file

@ -484,7 +484,6 @@ addLayer("a", {
color: "yellow", color: "yellow",
resource: "achievement power", resource: "achievement power",
row: "side", row: "side",
layerShown() {return true},
tooltip() { // Optional, tooltip displays when the layer is locked tooltip() { // Optional, tooltip displays when the layer is locked
return ("Achievements") return ("Achievements")
}, },

View file

@ -11,7 +11,7 @@ let modInfo = {
// Set your version in num and name // Set your version in num and name
let VERSION = { let VERSION = {
num: "2.3.2", num: "2.3.3",
name: "Cooler and Newer Edition", name: "Cooler and Newer Edition",
} }

View file

@ -388,10 +388,10 @@ function loadVue() {
key() {return this.$vnode.key} key() {return this.$vnode.key}
}, },
template: `<div> template: `<div>
<span v-for="(row, r) in data"><table> <span class="nodeRow" v-for="(row, r) in data"><table>
<td v-for="(node, id) in row" style = "{width: 0px}"> <span v-for="(node, id) in row" style = "{width: 0px}">
<tree-node :layer='node' :abb='tmp[node].symbol' :key="key + '-' + r + '-' + id"></tree-node> <tree-node :layer='node' :abb='tmp[node].symbol' :key="key + '-' + r + '-' + id"></tree-node>
</td> </span>
<tr><table><button class="treeNode hidden"></button></table></tr> <tr><table><button class="treeNode hidden"></button></table></tr>
</span></div> </span></div>

View file

@ -4,13 +4,17 @@ var gameEnded = false;
// Don't change this // Don't change this
const TMT_VERSION = { const TMT_VERSION = {
tmtNum: "2.3.2", tmtNum: "2.3.3",
tmtName: "Cooler and Newer Edition" tmtName: "Cooler and Newer Edition"
} }
function getResetGain(layer, useType = null) { function getResetGain(layer, useType = null) {
let type = useType 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") if(tmp[layer].type == "none")
return new Decimal (0) return new Decimal (0)
if (tmp[layer].gainExp.eq(0)) 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) { function getNextAt(layer, canMax=false, useType = null) {
let type = useType 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") if(tmp[layer].type == "none")
return new Decimal (Infinity) return new Decimal (Infinity)
@ -87,14 +96,14 @@ function shouldNotify(layer){
function canReset(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) return tmp[layer].baseAmount.gte(tmp[layer].requires)
else if(tmp[layer].type== "static") else if(tmp[layer].type== "static")
return tmp[layer].baseAmount.gte(tmp[layer].nextAt) return tmp[layer].baseAmount.gte(tmp[layer].nextAt)
if(tmp[layer].type == "none") else
return false return false
else
return run(layers[layer].canReset, layers[layer])
} }
function rowReset(row, layer) { function rowReset(row, layer) {

View file

@ -5,7 +5,7 @@ const decimalOne = new Decimal(1)
const decimalNaN = new Decimal(NaN) const decimalNaN = new Decimal(NaN)
function layerShown(layer){ function layerShown(layer){
return layers[layer].layerShown(); return tmp[layer].layerShown;
} }
var LAYERS = Object.keys(layers); 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].softcapPower === undefined) layers[layer].softcapPower = new Decimal("0.5")
if(layers[layer].displayRow === undefined) layers[layer].displayRow = layers[layer].row if(layers[layer].displayRow === undefined) layers[layer].displayRow = layers[layer].row
if(layers[layer].name === undefined) layers[layer].name = layer if(layers[layer].name === undefined) layers[layer].name = layer
if(layers[layer].layerShown === undefined) layers[layer].layerShown = true
let row = layers[layer].row let row = layers[layer].row

View file

@ -59,7 +59,7 @@ function format(decimal, precision=2,) {
function formatWhole(decimal) { function formatWhole(decimal) {
decimal = new Decimal(decimal) decimal = new Decimal(decimal)
if (decimal.gte(1e9)) return format(decimal, 2) 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) return format(decimal, 0)
} }
@ -698,7 +698,7 @@ function subtabResetNotify(layer, family, id){
} }
function nodeShown(layer) { function nodeShown(layer) {
if (tmp[layer].layerShown) return true if (layerShown(layer)) return true
switch(layer) { switch(layer) {
case "idk": case "idk":
return player.idk.unlocked return player.idk.unlocked
@ -788,7 +788,9 @@ function focused(x) {
function prestigeButtonText(layer) 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 ") : ""}+<b>${formatWhole(tmp[layer].resetGain)}</b> ${tmp[layer].resource} ${tmp[layer].resetGain.lt(100) && player[layer].points.lt(1e3) ? `<br><br>Next at ${ (tmp[layer].roundUpCost ? formatWhole(tmp[layer].nextAt) : format(tmp[layer].nextAt))} ${ tmp[layer].baseResource }` : ""}` return `${ player[layer].points.lt(1e3) ? (tmp[layer].resetDescription !== undefined ? tmp[layer].resetDescription : "Reset for ") : ""}+<b>${formatWhole(tmp[layer].resetGain)}</b> ${tmp[layer].resource} ${tmp[layer].resetGain.lt(100) && player[layer].points.lt(1e3) ? `<br><br>Next at ${ (tmp[layer].roundUpCost ? formatWhole(tmp[layer].nextAt) : format(tmp[layer].nextAt))} ${ tmp[layer].baseResource }` : ""}`
else if(tmp[layer].type== "static") else if(tmp[layer].type== "static")
return `${tmp[layer].resetDescription !== undefined ? tmp[layer].resetDescription : "Reset for "}+<b>${formatWhole(tmp[layer].resetGain)}</b> ${tmp[layer].resource}<br><br>${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 } return `${tmp[layer].resetDescription !== undefined ? tmp[layer].resetDescription : "Reset for "}+<b>${formatWhole(tmp[layer].resetGain)}</b> ${tmp[layer].resource}<br><br>${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") else if(tmp[layer].type == "none")
return "" return ""
else else
return layers[layer].prestigeButtonText() return "You need prestige button text"
} }
function isFunction(obj) { function isFunction(obj) {

View file

@ -56,6 +56,15 @@ td {
vertical-align: 0 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 { h1, h2, h3, b, input {
display: inline; display: inline;
font-family: "Lucida Console", "Courier New", monospace font-family: "Lucida Console", "Courier New", monospace