mirror of
https://github.com/Acamaeda/The-Modding-Tree.git
synced 2024-12-12 09:21:36 +00:00
Support for non-numeric ids
This commit is contained in:
parent
f4b4ec20d0
commit
04a27147a7
7 changed files with 14 additions and 13 deletions
|
@ -1,5 +1,7 @@
|
||||||
# The Modding Tree changelog:
|
# The Modding Tree changelog:
|
||||||
|
|
||||||
|
- You can now use non-numeric ids for upgrades, buyables, etc.
|
||||||
|
|
||||||
# v2.5.5.2 - 5/12/21
|
# v2.5.5.2 - 5/12/21
|
||||||
- Fixed a major issue with buyables.
|
- Fixed a major issue with buyables.
|
||||||
- Fixed a variety of tabFormat-related issues.
|
- Fixed a variety of tabFormat-related issues.
|
||||||
|
|
|
@ -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:
|
Individual achievement can have these features:
|
||||||
|
|
||||||
|
|
|
@ -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:
|
Individual Challenges can have these features:
|
||||||
|
|
||||||
|
|
|
@ -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:
|
Individual upgrades can have these features:
|
||||||
|
|
||||||
|
|
|
@ -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.
|
// Return true if the layer should be highlighted. By default checks for upgrades only.
|
||||||
function shouldNotify(layer){
|
function shouldNotify(layer){
|
||||||
for (id in tmp[layer].upgrades){
|
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){
|
if (canAffordUpgrade(layer, id) && !hasUpgrade(layer, id) && tmp[layer].upgrades[id].unlocked){
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ function setupLayer(layer){
|
||||||
if (layers[layer].upgrades){
|
if (layers[layer].upgrades){
|
||||||
setRowCol(layers[layer].upgrades)
|
setRowCol(layers[layer].upgrades)
|
||||||
for (thing in 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].id = thing
|
||||||
layers[layer].upgrades[thing].layer = layer
|
layers[layer].upgrades[thing].layer = layer
|
||||||
if (layers[layer].upgrades[thing].unlocked === undefined)
|
if (layers[layer].upgrades[thing].unlocked === undefined)
|
||||||
|
@ -76,7 +76,7 @@ function setupLayer(layer){
|
||||||
}
|
}
|
||||||
if (layers[layer].milestones){
|
if (layers[layer].milestones){
|
||||||
for (thing in 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].id = thing
|
||||||
layers[layer].milestones[thing].layer = layer
|
layers[layer].milestones[thing].layer = layer
|
||||||
if (layers[layer].milestones[thing].unlocked === undefined)
|
if (layers[layer].milestones[thing].unlocked === undefined)
|
||||||
|
@ -87,7 +87,7 @@ function setupLayer(layer){
|
||||||
if (layers[layer].achievements){
|
if (layers[layer].achievements){
|
||||||
setRowCol(layers[layer].achievements)
|
setRowCol(layers[layer].achievements)
|
||||||
for (thing in 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].id = thing
|
||||||
layers[layer].achievements[thing].layer = layer
|
layers[layer].achievements[thing].layer = layer
|
||||||
if (layers[layer].achievements[thing].unlocked === undefined)
|
if (layers[layer].achievements[thing].unlocked === undefined)
|
||||||
|
@ -98,7 +98,7 @@ function setupLayer(layer){
|
||||||
if (layers[layer].challenges){
|
if (layers[layer].challenges){
|
||||||
setRowCol(layers[layer].challenges)
|
setRowCol(layers[layer].challenges)
|
||||||
for (thing in 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].id = thing
|
||||||
layers[layer].challenges[thing].layer = layer
|
layers[layer].challenges[thing].layer = layer
|
||||||
if (layers[layer].challenges[thing].unlocked === undefined)
|
if (layers[layer].challenges[thing].unlocked === undefined)
|
||||||
|
@ -113,7 +113,7 @@ function setupLayer(layer){
|
||||||
layers[layer].buyables.layer = layer
|
layers[layer].buyables.layer = layer
|
||||||
setRowCol(layers[layer].buyables)
|
setRowCol(layers[layer].buyables)
|
||||||
for (thing in 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].id = thing
|
||||||
layers[layer].buyables[thing].layer = layer
|
layers[layer].buyables[thing].layer = layer
|
||||||
if (layers[layer].buyables[thing].unlocked === undefined)
|
if (layers[layer].buyables[thing].unlocked === undefined)
|
||||||
|
@ -130,7 +130,7 @@ function setupLayer(layer){
|
||||||
layers[layer].clickables.layer = layer
|
layers[layer].clickables.layer = layer
|
||||||
setRowCol(layers[layer].clickables)
|
setRowCol(layers[layer].clickables)
|
||||||
for (thing in 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].id = thing
|
||||||
layers[layer].clickables[thing].layer = layer
|
layers[layer].clickables[thing].layer = layer
|
||||||
if (layers[layer].clickables[thing].unlocked === undefined)
|
if (layers[layer].clickables[thing].unlocked === undefined)
|
||||||
|
@ -166,7 +166,6 @@ function setupLayer(layer){
|
||||||
layers[layer].grid.getCanClick = true
|
layers[layer].grid.getCanClick = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layers[layer].startData) {
|
if (layers[layer].startData) {
|
||||||
data = layers[layer].startData()
|
data = layers[layer].startData()
|
||||||
if (data.best !== undefined && data.showBest === undefined) layers[layer].showBest = true
|
if (data.best !== undefined && data.showBest === undefined) layers[layer].showBest = true
|
||||||
|
|
|
@ -153,7 +153,7 @@ function updateClickableTemp(layer)
|
||||||
|
|
||||||
function setupBuyables(layer) {
|
function setupBuyables(layer) {
|
||||||
for (id in layers[layer].buyables) {
|
for (id in layers[layer].buyables) {
|
||||||
if (!isNaN(id)) {
|
if (isPlainObject(layers[layer].buyables[id])) {
|
||||||
let b = layers[layer].buyables[id]
|
let b = layers[layer].buyables[id]
|
||||||
b.actualCostFunction = b.cost
|
b.actualCostFunction = b.cost
|
||||||
b.cost = function(x) {
|
b.cost = function(x) {
|
||||||
|
|
Loading…
Reference in a new issue