1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-12-03 13:21:34 +00:00

Support for non-numeric ids

This commit is contained in:
Harley White 2021-05-13 01:44:40 -04:00
parent f4b4ec20d0
commit 04a27147a7
7 changed files with 14 additions and 13 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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