diff --git a/changelog.md b/changelog.md index ddc7f8a..f8a1b09 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,7 @@ # The Modding Tree changelog: +- You can now use non-numeric ids for upgrades, buyables, etc. + # v2.5.5.2 - 5/12/21 - Fixed a major issue with buyables. - Fixed a variety of tabFormat-related issues. diff --git a/docs/achievements.md b/docs/achievements.md index ae71170..e01fbfd 100644 --- a/docs/achievements.md +++ b/docs/achievements.md @@ -21,7 +21,7 @@ achievements: { } ``` -Each achievement should have an id where the first digit is the row and the second digit is the column. +Usually, each achievement should have an id where the first digit is the row and the second digit is the column. Individual achievement can have these features: diff --git a/docs/challenges.md b/docs/challenges.md index 0c36d3f..9c02d55 100644 --- a/docs/challenges.md +++ b/docs/challenges.md @@ -22,7 +22,7 @@ challenges: { } ``` -Each challenge should have an id where the first digit is the row and the second digit is the column. +Usually, each challenge should have an id where the first digit is the row and the second digit is the column. Individual Challenges can have these features: diff --git a/docs/upgrades.md b/docs/upgrades.md index 78aa044..9a9f413 100644 --- a/docs/upgrades.md +++ b/docs/upgrades.md @@ -21,7 +21,7 @@ upgrades: { } ``` -Each upgrade should have an id where the first digit is the row and the second digit is the column. +Usually, upgrades should have an id where the first digit is the row and the second digit is the column. Individual upgrades can have these features: diff --git a/js/game.js b/js/game.js index 71d4894..ec0a9fb 100644 --- a/js/game.js +++ b/js/game.js @@ -80,7 +80,7 @@ function softcap(value, cap, power = 0.5) { // Return true if the layer should be highlighted. By default checks for upgrades only. function shouldNotify(layer){ for (id in tmp[layer].upgrades){ - if (!isNaN(id)){ + if (isPlainObject(layers[layer].upgrades[id])){ if (canAffordUpgrade(layer, id) && !hasUpgrade(layer, id) && tmp[layer].upgrades[id].unlocked){ return true } diff --git a/js/technical/layerSupport.js b/js/technical/layerSupport.js index 6e0e277..c10701e 100644 --- a/js/technical/layerSupport.js +++ b/js/technical/layerSupport.js @@ -66,7 +66,7 @@ function setupLayer(layer){ if (layers[layer].upgrades){ setRowCol(layers[layer].upgrades) for (thing in layers[layer].upgrades){ - if (!isNaN(thing)){ + if (isPlainObject(layers[layer].upgrades[thing])){ layers[layer].upgrades[thing].id = thing layers[layer].upgrades[thing].layer = layer if (layers[layer].upgrades[thing].unlocked === undefined) @@ -76,7 +76,7 @@ function setupLayer(layer){ } if (layers[layer].milestones){ for (thing in layers[layer].milestones){ - if (!isNaN(thing)){ + if (isPlainObject(layers[layer].milestones[thing])){ layers[layer].milestones[thing].id = thing layers[layer].milestones[thing].layer = layer if (layers[layer].milestones[thing].unlocked === undefined) @@ -87,7 +87,7 @@ function setupLayer(layer){ if (layers[layer].achievements){ setRowCol(layers[layer].achievements) for (thing in layers[layer].achievements){ - if (!isNaN(thing)){ + if (isPlainObject(layers[layer].achievements[thing])){ layers[layer].achievements[thing].id = thing layers[layer].achievements[thing].layer = layer if (layers[layer].achievements[thing].unlocked === undefined) @@ -98,7 +98,7 @@ function setupLayer(layer){ if (layers[layer].challenges){ setRowCol(layers[layer].challenges) for (thing in layers[layer].challenges){ - if (!isNaN(thing)){ + if (isPlainObject(layers[layer].challenges[thing])){ layers[layer].challenges[thing].id = thing layers[layer].challenges[thing].layer = layer if (layers[layer].challenges[thing].unlocked === undefined) @@ -113,7 +113,7 @@ function setupLayer(layer){ layers[layer].buyables.layer = layer setRowCol(layers[layer].buyables) for (thing in layers[layer].buyables){ - if (!isNaN(thing)){ + if (isPlainObject(layers[layer].buyables[thing])){ layers[layer].buyables[thing].id = thing layers[layer].buyables[thing].layer = layer if (layers[layer].buyables[thing].unlocked === undefined) @@ -125,12 +125,12 @@ function setupLayer(layer){ } } - + if (layers[layer].clickables){ layers[layer].clickables.layer = layer setRowCol(layers[layer].clickables) for (thing in layers[layer].clickables){ - if (!isNaN(thing)){ + if (isPlainObject(layers[layer].clickables[thing])){ layers[layer].clickables[thing].id = thing layers[layer].clickables[thing].layer = layer if (layers[layer].clickables[thing].unlocked === undefined) @@ -166,7 +166,6 @@ function setupLayer(layer){ layers[layer].grid.getCanClick = true } - if (layers[layer].startData) { data = layers[layer].startData() if (data.best !== undefined && data.showBest === undefined) layers[layer].showBest = true diff --git a/js/technical/temp.js b/js/technical/temp.js index ef7a58b..bc086ad 100644 --- a/js/technical/temp.js +++ b/js/technical/temp.js @@ -153,7 +153,7 @@ function updateClickableTemp(layer) function setupBuyables(layer) { for (id in layers[layer].buyables) { - if (!isNaN(id)) { + if (isPlainObject(layers[layer].buyables[id])) { let b = layers[layer].buyables[id] b.actualCostFunction = b.cost b.cost = function(x) {