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:
## 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.

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.
- 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.

View file

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

View file

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

View file

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

View file

@ -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")
return false
else
return run(layers[layer].canReset, layers[layer])
return false
}
function rowReset(row, layer) {

View file

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

View file

@ -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 ") : ""}+<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")
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")
return ""
else
return layers[layer].prestigeButtonText()
return "You need prestige button text"
}
function isFunction(obj) {

View file

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