mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-11-30 20:02:07 +00:00
Hopefully fully fixed the order of operations in temp issue
This commit is contained in:
parent
808327b730
commit
f154615f5c
2 changed files with 125 additions and 60 deletions
|
@ -30,7 +30,6 @@ addLayer("c", {
|
||||||
},
|
},
|
||||||
row: 0, // Row the layer is in on the tree (0 is the first row)
|
row: 0, // Row the layer is in on the tree (0 is the first row)
|
||||||
effect() {
|
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
|
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)),
|
waffleBoost: (true == false ? 0 : Decimal.pow(player[this.layer].points, 0.2)),
|
||||||
icecreamCap: (player[this.layer].points * 10)
|
icecreamCap: (player[this.layer].points * 10)
|
||||||
|
|
184
js/temp.js
184
js/temp.js
|
@ -6,68 +6,35 @@ function updateTemp() {
|
||||||
for (layer in layers) {
|
for (layer in layers) {
|
||||||
if(layers[layer].challs !== undefined){
|
if(layers[layer].challs !== undefined){
|
||||||
tmp.challActive[layer] = {}
|
tmp.challActive[layer] = {}
|
||||||
updateChallTemp(layer)
|
setupChallTemp(layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tmp.upgrades) tmp.upgrades = {}
|
if (!tmp.upgrades) tmp.upgrades = {}
|
||||||
for (layer in layers) {
|
for (layer in layers) {
|
||||||
if(layers[layer].upgrades !== undefined){
|
if(layers[layer].upgrades !== undefined){
|
||||||
updateUpgradeTemp(layer)
|
setupUpgradeTemp(layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tmp.milestones) tmp.milestones = {}
|
if (!tmp.milestones) tmp.milestones = {}
|
||||||
for (layer in layers) {
|
for (layer in layers) {
|
||||||
if(layers[layer].milestones !== undefined){
|
if(layers[layer].milestones !== undefined){
|
||||||
updateMilestoneTemp(layer)
|
setupMilestoneTemp(layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!tmp.buyables) tmp.buyables = {}
|
if (!tmp.buyables) tmp.buyables = {}
|
||||||
for (layer in layers) if (layers[layer].buyables) {
|
for (layer in layers) if (layers[layer].buyables) {
|
||||||
if(layers[layer].buyables !== undefined){
|
if(layers[layer].buyables !== undefined){
|
||||||
updateBuyableTemp(layer)
|
setupBuyableTemp(layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tmp.microtabs) tmp.microtabs = {}
|
|
||||||
for (layer in layers) {
|
|
||||||
if (!tmp.microtabs[layer]) tmp.microtabs[layer] = {}
|
|
||||||
if (layers[layer].microtabs) {
|
|
||||||
if(layers[layer].microtabs !== undefined){
|
|
||||||
updateMicrotabTemp(layer)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(layers[layer].tabFormat && !Array.isArray(layers[layer].tabFormat)){
|
|
||||||
let data2 = layers[layer].tabFormat
|
|
||||||
let set = "mainTabs"
|
|
||||||
if (!tmp.microtabs[layer][set]) tmp.microtabs[layer][set] = {}
|
|
||||||
for (tab in data2) {
|
|
||||||
if (!tmp.microtabs[layer][set][tab])
|
|
||||||
tmp.microtabs[layer][set][tab] = {}
|
|
||||||
if(data2[tab].style)
|
|
||||||
tmp.microtabs[layer][set][tab].style = data2[tab].style()
|
|
||||||
if(data2[tab].buttonStyle)
|
|
||||||
tmp.microtabs[layer][set][tab].buttonStyle = data2[tab].buttonStyle()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tmp.layerEffs) tmp.layerEffs = {}
|
|
||||||
for (layer in layers) if (layers[layer].effect) tmp.layerEffs[layer] = layers[layer].effect()
|
|
||||||
|
|
||||||
if (!tmp.layerReqs) tmp.layerReqs = {}
|
if (!tmp.layerReqs) tmp.layerReqs = {}
|
||||||
for (layer in layers) tmp.layerReqs[layer] = layers[layer].requires()
|
for (layer in layers) tmp.layerReqs[layer] = layers[layer].requires()
|
||||||
|
|
||||||
|
if (!tmp.layerEffs) tmp.layerEffs = {}
|
||||||
if (!tmp.componentStyles) tmp.componentStyles = {}
|
for (layer in layers) if (layers[layer].effect) tmp.layerEffs[layer] = layers[layer].effect()
|
||||||
for (layer in layers) if (layers[layer].componentStyles) {
|
|
||||||
if(layers[layer].componentStyles !== undefined){
|
|
||||||
tmp.componentStyles[layer] = {}
|
|
||||||
for (item in layers[layer].componentStyles)
|
|
||||||
tmp.componentStyles[layer][item] = layers[layer].componentStyles[item]()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!tmp.gainMults) tmp.gainMults = {}
|
if (!tmp.gainMults) tmp.gainMults = {}
|
||||||
if (!tmp.gainExp) tmp.gainExp = {}
|
if (!tmp.gainExp) tmp.gainExp = {}
|
||||||
|
@ -110,36 +77,73 @@ function updateTemp() {
|
||||||
for (layer in layers){
|
for (layer in layers){
|
||||||
if (layers[layer].updateTemp) layers[layer].updateTemp()
|
if (layers[layer].updateTemp) layers[layer].updateTemp()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (!tmp.componentStyles) tmp.componentStyles = {}
|
||||||
|
for (layer in layers) if (layers[layer].componentStyles) {
|
||||||
|
if(layers[layer].componentStyles !== undefined){
|
||||||
|
tmp.componentStyles[layer] = {}
|
||||||
|
for (item in layers[layer].componentStyles)
|
||||||
|
tmp.componentStyles[layer][item] = layers[layer].componentStyles[item]()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function setupChallTemp(layer) {
|
if (!tmp.microtabs) tmp.microtabs = {}
|
||||||
if (player[layer] === undefined) return
|
for (layer in layers) {
|
||||||
if (!tmp.challs[layer]) tmp.challs[layer] = {}
|
if (!tmp.microtabs[layer]) tmp.microtabs[layer] = {}
|
||||||
|
if (layers[layer].microtabs) {
|
||||||
|
if(layers[layer].microtabs !== undefined){
|
||||||
|
updateMicrotabTemp(layer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(layers[layer].tabFormat && !Array.isArray(layers[layer].tabFormat)){
|
||||||
|
let data2 = layers[layer].tabFormat
|
||||||
|
let set = "mainTabs"
|
||||||
|
if (!tmp.microtabs[layer][set]) tmp.microtabs[layer][set] = {}
|
||||||
|
for (tab in data2) {
|
||||||
|
if (!tmp.microtabs[layer][set][tab])
|
||||||
|
tmp.microtabs[layer][set][tab] = {}
|
||||||
|
if(data2[tab].style)
|
||||||
|
tmp.microtabs[layer][set][tab].style = data2[tab].style()
|
||||||
|
if(data2[tab].buttonStyle)
|
||||||
|
tmp.microtabs[layer][set][tab].buttonStyle = data2[tab].buttonStyle()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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
|
if (!tmp.challActive) {tmp.challActive = {}}
|
||||||
else delete data[id]
|
if (!tmp.challs) tmp.challs = {}
|
||||||
|
for (layer in layers) {
|
||||||
|
if(layers[layer].challs !== undefined){
|
||||||
|
tmp.challActive[layer] = {}
|
||||||
|
updateChallTemp(layer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
tmp.challs[layer][id].unl = data2[id].unl()
|
if (!tmp.upgrades) tmp.upgrades = {}
|
||||||
if(data2[id].name) tmp.challs[layer][id].name = data2[id].name()
|
for (layer in layers) {
|
||||||
if(data2[id].desc) tmp.challs[layer][id].desc = data2[id].desc()
|
if(layers[layer].upgrades !== undefined){
|
||||||
if(data2[id].reward) tmp.challs[layer][id].reward = data2[id].reward()
|
updateUpgradeTemp(layer)
|
||||||
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()
|
if (!tmp.milestones) tmp.milestones = {}
|
||||||
|
for (layer in layers) {
|
||||||
|
if(layers[layer].milestones !== undefined){
|
||||||
|
updateMilestoneTemp(layer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!tmp.buyables) tmp.buyables = {}
|
||||||
|
for (layer in layers) if (layers[layer].buyables) {
|
||||||
|
if(layers[layer].buyables !== undefined){
|
||||||
|
updateBuyableTemp(layer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function updateChallTemp(layer) {
|
function updateChallTemp(layer) {
|
||||||
if (player[layer] === undefined) return
|
if (player[layer] === undefined) return
|
||||||
if (!tmp.challs[layer]) tmp.challs[layer] = {}
|
if (!tmp.challs[layer]) tmp.challs[layer] = {}
|
||||||
|
@ -241,3 +245,65 @@ function updateMicrotabTemp(layer) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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++) {
|
||||||
|
let id = row * 10 + col
|
||||||
|
|
||||||
|
tmp.challs[layer][id] = {}
|
||||||
|
if(data2[id].effect) tmp.challs[layer][id].effect = {}
|
||||||
|
if(data2[id].style) tmp.challs[layer][id].style = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupUpgradeTemp(layer) {
|
||||||
|
if (layers[layer] === undefined) return
|
||||||
|
if (!tmp.upgrades[layer]) tmp.upgrades[layer] = {}
|
||||||
|
|
||||||
|
let data2 = layers[layer].upgrades
|
||||||
|
for (let row = 1; row <= data2.rows; row++) {
|
||||||
|
for (let col = 1; col <= data2.cols; col++) {
|
||||||
|
let id = row * 10 + col
|
||||||
|
tmp.upgrades[layer][id] = {}
|
||||||
|
if(data2[id].effect) tmp.upgrades[layer][id].effect = {}
|
||||||
|
if(data2[id].style) tmp.upgrades[layer][id].style = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupMilestoneTemp(layer) {
|
||||||
|
if (layers[layer] === undefined) return
|
||||||
|
if (!tmp.milestones[layer]) tmp.milestones[layer] = {}
|
||||||
|
|
||||||
|
let data2 = layers[layer].milestones
|
||||||
|
for (id in data2) {
|
||||||
|
tmp.milestones[layer][id] = {}
|
||||||
|
if(data2[id].style) tmp.milestones[layer][id].style = {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setupBuyableTemp(layer) {
|
||||||
|
if (layers[layer] === undefined) return
|
||||||
|
if (!tmp.buyables[layer]) tmp.buyables[layer] = {}
|
||||||
|
let data2 = layers[layer].buyables
|
||||||
|
for (let row = 1; row <= data2.rows; row++) {
|
||||||
|
for (let col = 1; col <= data2.cols; col++) {
|
||||||
|
let id = row * 10 + col
|
||||||
|
let amt = player[layer].buyables[id]
|
||||||
|
tmp.buyables[layer][id] = {}
|
||||||
|
if(data2[id].effect) tmp.buyables[layer][id].effect = {}
|
||||||
|
tmp.buyables[layer][id].cost = {}
|
||||||
|
if(data2[id].style) tmp.buyables[layer][id].style = {}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue