1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-24 17:31:50 +00:00

Rearranged the order to reduce the amount of temp conflicts

This commit is contained in:
Acamaeda 2020-10-07 17:00:02 -04:00
parent d0e657bc5b
commit 808327b730
2 changed files with 35 additions and 10 deletions

View file

@ -30,6 +30,7 @@ addLayer("c", {
},
row: 0, // Row the layer is in on the tree (0 is the first row)
effect() {
console.log(tmp.buyables)
return { // Formulas for any boosts inherent to resources in the layer. Can return a single value instead of an object if there is just one effect
waffleBoost: (true == false ? 0 : Decimal.pow(player[this.layer].points, 0.2)),
icecreamCap: (player[this.layer].points * 10)

View file

@ -23,13 +23,6 @@ function updateTemp() {
updateMilestoneTemp(layer)
}
}
if (!tmp.layerEffs) tmp.layerEffs = {}
for (layer in layers) if (layers[layer].effect) tmp.layerEffs[layer] = layers[layer].effect()
if (!tmp.layerReqs) tmp.layerReqs = {}
for (layer in layers) tmp.layerReqs[layer] = layers[layer].requires()
if (!tmp.buyables) tmp.buyables = {}
for (layer in layers) if (layers[layer].buyables) {
if(layers[layer].buyables !== undefined){
@ -60,6 +53,12 @@ function updateTemp() {
}
}
if (!tmp.layerEffs) tmp.layerEffs = {}
for (layer in layers) if (layers[layer].effect) tmp.layerEffs[layer] = layers[layer].effect()
if (!tmp.layerReqs) tmp.layerReqs = {}
for (layer in layers) tmp.layerReqs[layer] = layers[layer].requires()
if (!tmp.componentStyles) tmp.componentStyles = {}
for (layer in layers) if (layers[layer].componentStyles) {
@ -113,6 +112,34 @@ function updateTemp() {
}
}
function setupChallTemp(layer) {
if (player[layer] === undefined) return
if (!tmp.challs[layer]) tmp.challs[layer] = {}
let data = tmp.challActive[layer]
let data2 = layers[layer].challs
let customActive = data2.active !== undefined
for (let row = 1; row <= data2.rows; row++) {
for (let col = 1; col <= data2.cols; col++) {
tmp.challs[layer][id] = {}
if (customActive ? data2.active(id) : player[layer].active == id) data[id] = 1
else delete data[id]
tmp.challs[layer][id].unl = data2[id].unl()
if(data2[id].name) tmp.challs[layer][id].name = data2[id].name()
if(data2[id].desc) tmp.challs[layer][id].desc = data2[id].desc()
if(data2[id].reward) tmp.challs[layer][id].reward = data2[id].reward()
if(data2[id].effect) tmp.challs[layer][id].effect = data2[id].effect()
if(data2[id].effectDisplay) tmp.challs[layer][id].effectDisplay = data2[id].effectDisplay(tmp.challs[layer][id].effect)
tmp.challs[layer][id].goal = data2[id].goal()
if(data2[id].style) tmp.challs[layer][id].style = data2[id].style()
}
}
}
function updateChallTemp(layer) {
if (player[layer] === undefined) return
if (!tmp.challs[layer]) tmp.challs[layer] = {}
@ -155,10 +182,7 @@ function updateUpgradeTemp(layer) {
if(data2[id].effectDisplay) tmp.upgrades[layer][id].effectDisplay = data2[id].effectDisplay(tmp.upgrades[layer][id].effect)
if(data2[id].desc) tmp.upgrades[layer][id].desc = data2[id].desc()
if(data2[id].title) tmp.upgrades[layer][id].title = data2[id].title()
if(data2[id].style) tmp.upgrades[layer][id].style = data2[id].style()
}
}
}