1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-24 09:21:46 +00:00

Fixed many tabFormat issues

This commit is contained in:
Harley White 2021-05-12 23:21:39 -04:00
parent 2d56c25917
commit f4b4ec20d0
8 changed files with 27 additions and 45 deletions

View file

@ -1,5 +1,10 @@
# The Modding Tree changelog:
# v2.5.5.2 - 5/12/21
- Fixed a major issue with buyables.
- Fixed a variety of tabFormat-related issues.
- Fixed commas appearing in decimal places (thanks to pg132!)
# v2.5.5.1 - 5/12/21
- Fixed clickables.

View file

@ -68,6 +68,8 @@ These are the existing components, but you can create more in [components.js](/j
- grid: Displays the gridable grid for the layer. If you need more than one grid, use a layer proxy.
- layer-proxy: Lets you use components from another layer. The argument is a pair, `[layer, data]`, consisting of the id of the layer to proxy from, and the tabFormat for the components to show.
(Note: you cannot use a microtab within a layer proxy)
The rest of the components are sub-components. They can be used just like other components, but are typically part of another component.

View file

@ -6,7 +6,6 @@ addLayer("c", {
name: "Candies", // This is optional, only used in a few places, If absent it just uses the layer id.
symbol: "C", // This appears on the layer's node. Default is the id with the first letter capitalized
position: 0, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order
marked: "discord.png",
startData() { return {
unlocked: true,
points: new Decimal(0),
@ -319,7 +318,7 @@ addLayer("c", {
["buyables", ""], "blank",
["row", [
["toggle", ["c", "beep"]], ["blank", ["30px", "10px"]], // Width, height
["layer-proxy", ["f", ["prestige-button"]]], "blank", ["v-line", "200px"],
["display-text", function() {return "Beep"}], "blank", ["v-line", "200px"],
["column", [
["prestige-button", "", {'width': '150px', 'height': '80px'}],
["prestige-button", "", {'width': '100px', 'height': '150px'}],
@ -427,7 +426,6 @@ addLayer("f", {
canReset() {
return tmp[this.layer].baseAmount.gte(tmp[this.layer].nextAt)
},
// This is also non minimal, a Clickable!
clickables: {
@ -526,32 +524,5 @@ addLayer("a", {
onComplete() {console.log("Bork bork bork!")}
},
},
grid: {
maxRows: 3,
rows: 2,
cols: 2,
getStartData(id) {
return id
},
getUnlocked(id) { // Default
return true
},
getCanClick(data, id) {
return true
},
getStyle(data, id) {
return {'background-color': '#'+ (data*1234%999999)}
},
onClick(data, id) { // Don't forget onHold
player[this.layer].grid[id]++
},
getTitle(data, id) {
return "Gridable #" + id
},
getDisplay(data, id) {
return data
},
} ,
midsection: ["grid", "blank"]
}
)
},
)

View file

@ -11,7 +11,7 @@ let modInfo = {
// Set your version in num and name
let VERSION = {
num: "2.5.5.1",
num: "2.5.5.2",
name: "Dreams Really Do Come True",
}

View file

@ -5,7 +5,7 @@ var scrolled = false;
// Don't change this
const TMT_VERSION = {
tmtNum: "2.5.5.1",
tmtNum: "2.5.5.2",
tmtName: "Dreams Really Do Come True"
}

View file

@ -143,9 +143,7 @@ function constructTabFormat(layer, id, family){
}
if (isFunction(tabLayer)) {
let bound = tabLayer.bind(layers[layer])
Vue.set(tabTemp, key, bound())
return tabLayer()
}
updateTempData(tabLayer, tabTemp, tabFunc)
return tabTemp
@ -173,7 +171,7 @@ function updateTabFormat(layer) {
// Check for embedded layer
if (isPlainObject(tmp[layer].tabFormat) && tmp[layer].tabFormat[tab].embedLayer !== undefined) {
constructTabFormat(tmp[layer].tabFormat[tab].embedLayer)
updateTabFormat(tmp[layer].tabFormat[tab].embedLayer)
}
// Update microtabs
@ -183,9 +181,9 @@ function updateTabFormat(layer) {
if (tmp[layer].microtabs[family][tab]) {
if (tmp[layer].microtabs[family][tab].embedLayer)
constructTabFormat(tmp[layer].microtabs[family][tab].embedLayer)
updateTabFormat(tmp[layer].microtabs[family][tab].embedLayer)
else
constructTabFormat(layer, tab, family)
Vue.set(temp[layer].microtabs[family][tab], 'content', constructTabFormat(layer, tab, family))
}
}
}

View file

@ -118,12 +118,14 @@ function setupLayer(layer){
layers[layer].buyables[thing].layer = layer
if (layers[layer].buyables[thing].unlocked === undefined)
layers[layer].buyables[thing].unlocked = true
}
layers[layer].buyables[thing].canBuy = function() {return canBuyBuyable(this.layer, this.id)}
if (layers[layer].buyables[thing].purchaseLimit === undefined) layers[layer].buyables[thing].purchaseLimit = new Decimal(Infinity)
}
}
}
}
if (layers[layer].clickables){
layers[layer].clickables.layer = layer
setRowCol(layers[layer].clickables)

View file

@ -15,14 +15,18 @@ function exponentialFormat(num, precision, mantissa = true) {
function commaFormat(num, precision) {
if (num === null || num === undefined) return "NaN"
if (num.mag < 0.001) return (0).toFixed(precision)
return num.toStringWithDecimalPlaces(precision).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")
let init = num.toStringWithDecimalPlaces(precision)
let portions = init.split(".")
portions[0] = portions[0].replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")
if (portions.length == 1) return portions[0]
return portions[0] + "." + portions[1]
}
function regularFormat(num, precision) {
if (num === null || num === undefined) return "NaN"
if (num.mag < 0.0001) return (0).toFixed(precision)
if (num.mag < 0.1 && precision !==0) precision = 4
if (num.mag < 0.1 && precision !==0) precision = Math.max(precision, 4)
return num.toStringWithDecimalPlaces(precision)
}