From e18f1bdd47d4a4bca535fc94da59f7ef382e549c Mon Sep 17 00:00:00 2001 From: Harley White Date: Thu, 29 Apr 2021 18:20:31 -0400 Subject: [PATCH] Automated rows and cols --- changelog.md | 3 +++ docs/achievements.md | 2 -- docs/buyables.md | 2 -- docs/challenges.md | 2 -- docs/clickables.md | 2 -- docs/upgrades.md | 2 -- js/Demo/demoLayers.js | 14 ++++---------- js/Demo/demoMod.js | 4 ++-- js/game.js | 4 ++-- js/technical/layerSupport.js | 18 ++++++++++++++++++ 10 files changed, 29 insertions(+), 24 deletions(-) diff --git a/changelog.md b/changelog.md index c59c034..87f0de5 100644 --- a/changelog.md +++ b/changelog.md @@ -1,13 +1,16 @@ # The Modding Tree changelog: +## v2.4: Rationalized Edition - Completely reworked tooltips. Shift-click a node to force its tooltip to stay displayed. (And hopefully finally fixed flickering!) - Added text-input and slider components. - Added the ability to toggle respec confirmations. - Added custom respec confirmation messages. - The red layer highlight will not appear before a layer is unlocked. - Added unlocking hotkeys. +- You no longer need to supply 'rows' and 'cols' for any Big Features. - Node symbols can use HTML. - Added documentation for the respec button. +- The version number no longer contains special characters or irrational numbers. # v2.π.1 - 4/7/21 - Fixed formatting for some larger numbers. diff --git a/docs/achievements.md b/docs/achievements.md index 6309855..f46ce9b 100644 --- a/docs/achievements.md +++ b/docs/achievements.md @@ -13,8 +13,6 @@ Achievements should be formatted like this: ```js achievements: { - rows: # of rows, - cols: # of columns, 11: { name: "Blah", more features diff --git a/docs/buyables.md b/docs/buyables.md index 8e64945..1a827bc 100644 --- a/docs/buyables.md +++ b/docs/buyables.md @@ -14,8 +14,6 @@ Buyables should be formatted like this: ```js buyables: { - rows: # of rows, - cols: # of columns, 11: { cost(x) { return new Decimal(1).mul(x || getBuyableAmt(this.layer, this.id)) }, display() { return "Blah" }, diff --git a/docs/challenges.md b/docs/challenges.md index 81c6e1b..8088fd0 100644 --- a/docs/challenges.md +++ b/docs/challenges.md @@ -12,8 +12,6 @@ Challenges are stored in the following format: ```js challenges: { - rows: # of rows, - cols: # of columns, 11: { name: "Ouch", challengeDescription: "description of ouchie", diff --git a/docs/clickables.md b/docs/clickables.md index 4fc7af7..f21db92 100644 --- a/docs/clickables.md +++ b/docs/clickables.md @@ -16,8 +16,6 @@ Clickables should be formatted like this: ```js clickables: { - rows: # of rows, - cols: # of columns, 11: { display() {return "Blah"}, etc diff --git a/docs/upgrades.md b/docs/upgrades.md index ccb706f..78aa044 100644 --- a/docs/upgrades.md +++ b/docs/upgrades.md @@ -12,8 +12,6 @@ Upgrades are stored in the following format: ```js upgrades: { - rows: # of rows, - cols: # of columns, 11: { description: "Blah", cost: new Decimal(100), diff --git a/js/Demo/demoLayers.js b/js/Demo/demoLayers.js index 18034a8..7005109 100644 --- a/js/Demo/demoLayers.js +++ b/js/Demo/demoLayers.js @@ -78,8 +78,7 @@ addLayer("c", { }, }, challenges: { - rows: 2, - cols: 12, + 11: { name: "Fun", completionLimit: 3, @@ -100,8 +99,7 @@ addLayer("c", { }, }, upgrades: { - rows: 2, - cols: 3, + 11: { title: "Generator of Genericness", description: "Gain 1 Point every second.", @@ -150,8 +148,7 @@ addLayer("c", { }, }, buyables: { - rows: 1, - cols: 12, + showRespec: true, respec() { // Optional, reset things and give back your currency. Having this function makes a respec button appear player[this.layer].points = player[this.layer].points.add(player[this.layer].spentOnBuyables) // A built-in thing to keep track of this but only keeps a single value @@ -421,8 +418,7 @@ addLayer("f", { }, // This is also non minimal, a Clickable! clickables: { - rows: 1, - cols: 1, + masterButtonPress() { if (getClickableState(this.layer, 11) == "Borkened...") player[this.layer].clickables[11] = "Start" @@ -495,8 +491,6 @@ addLayer("a", { }, achievementPopups: true, achievements: { - rows: 2, - cols: 3, 11: { image: "discord.png", name: "Get me!", diff --git a/js/Demo/demoMod.js b/js/Demo/demoMod.js index cd03677..48743c2 100644 --- a/js/Demo/demoMod.js +++ b/js/Demo/demoMod.js @@ -11,8 +11,8 @@ let modInfo = { // Set your version in num and name let VERSION = { - num: "2.π.1", - name: "Incrementally Updated", + num: "2.4", + name: "Rationalized Edition", } let changelog = `

Changelog:


diff --git a/js/game.js b/js/game.js index d92e28c..8189bcb 100644 --- a/js/game.js +++ b/js/game.js @@ -5,8 +5,8 @@ var scrolled = false; // Don't change this const TMT_VERSION = { - tmtNum: "2.π.1", - tmtName: "Incrementally Updated" + tmtNum: "2.4", + tmtName: "Rationalized Edition" } function getResetGain(layer, useType = null) { diff --git a/js/technical/layerSupport.js b/js/technical/layerSupport.js index 6a9433f..45003c2 100644 --- a/js/technical/layerSupport.js +++ b/js/technical/layerSupport.js @@ -64,6 +64,7 @@ function updateLayers(){ function setupLayer(layer){ layers[layer].layer = layer if (layers[layer].upgrades){ + setRowCol(layers[layer].upgrades) for (thing in layers[layer].upgrades){ if (!isNaN(thing)){ layers[layer].upgrades[thing].id = thing @@ -84,6 +85,7 @@ function setupLayer(layer){ } } if (layers[layer].achievements){ + setRowCol(layers[layer].achievements) for (thing in layers[layer].achievements){ if (!isNaN(thing)){ layers[layer].achievements[thing].id = thing @@ -94,6 +96,7 @@ function setupLayer(layer){ } } if (layers[layer].challenges){ + setRowCol(layers[layer].challenges) for (thing in layers[layer].challenges){ if (!isNaN(thing)){ layers[layer].challenges[thing].id = thing @@ -108,6 +111,7 @@ function setupLayer(layer){ } if (layers[layer].buyables){ layers[layer].buyables.layer = layer + setRowCol(layers[layer].buyables) for (thing in layers[layer].buyables){ if (!isNaN(thing)){ layers[layer].buyables[thing].id = thing @@ -120,6 +124,7 @@ 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)){ layers[layer].clickables[thing].id = thing @@ -225,6 +230,19 @@ function readData(data, args=null){ return data; } +function setRowCol(upgrades) { + let maxRow = 0 + let maxCol = 0 + for (up in upgrades) { + if (!isNaN(up)) { + if (Math.floor(up/10) > maxRow) maxRow = Math.floor(up/10) + if (up%10 > maxCol) maxCol = up%10 + } + } + upgrades.rows = maxRow + upgrades.cols = maxCol +} + function someLayerUnlocked(row){ for (layer in ROW_LAYERS[row]) if (player[layer].unlocked)