1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2024-11-21 16:13:55 +00:00

Automated rows and cols

This commit is contained in:
Harley White 2021-04-29 18:20:31 -04:00
parent 9fe4a17a38
commit e18f1bdd47
10 changed files with 29 additions and 24 deletions

View file

@ -1,13 +1,16 @@
# The Modding Tree changelog: # 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!) - 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 text-input and slider components.
- Added the ability to toggle respec confirmations. - Added the ability to toggle respec confirmations.
- Added custom respec confirmation messages. - Added custom respec confirmation messages.
- The red layer highlight will not appear before a layer is unlocked. - The red layer highlight will not appear before a layer is unlocked.
- Added unlocking hotkeys. - Added unlocking hotkeys.
- You no longer need to supply 'rows' and 'cols' for any Big Features.
- Node symbols can use HTML. - Node symbols can use HTML.
- Added documentation for the respec button. - Added documentation for the respec button.
- The version number no longer contains special characters or irrational numbers.
# v2.π.1 - 4/7/21 # v2.π.1 - 4/7/21
- Fixed formatting for some larger numbers. - Fixed formatting for some larger numbers.

View file

@ -13,8 +13,6 @@ Achievements should be formatted like this:
```js ```js
achievements: { achievements: {
rows: # of rows,
cols: # of columns,
11: { 11: {
name: "Blah", name: "Blah",
more features more features

View file

@ -14,8 +14,6 @@ Buyables should be formatted like this:
```js ```js
buyables: { buyables: {
rows: # of rows,
cols: # of columns,
11: { 11: {
cost(x) { return new Decimal(1).mul(x || getBuyableAmt(this.layer, this.id)) }, cost(x) { return new Decimal(1).mul(x || getBuyableAmt(this.layer, this.id)) },
display() { return "Blah" }, display() { return "Blah" },

View file

@ -12,8 +12,6 @@ Challenges are stored in the following format:
```js ```js
challenges: { challenges: {
rows: # of rows,
cols: # of columns,
11: { 11: {
name: "Ouch", name: "Ouch",
challengeDescription: "description of ouchie", challengeDescription: "description of ouchie",

View file

@ -16,8 +16,6 @@ Clickables should be formatted like this:
```js ```js
clickables: { clickables: {
rows: # of rows,
cols: # of columns,
11: { 11: {
display() {return "Blah"}, display() {return "Blah"},
etc etc

View file

@ -12,8 +12,6 @@ Upgrades are stored in the following format:
```js ```js
upgrades: { upgrades: {
rows: # of rows,
cols: # of columns,
11: { 11: {
description: "Blah", description: "Blah",
cost: new Decimal(100), cost: new Decimal(100),

View file

@ -78,8 +78,7 @@ addLayer("c", {
}, },
}, },
challenges: { challenges: {
rows: 2,
cols: 12,
11: { 11: {
name: "Fun", name: "Fun",
completionLimit: 3, completionLimit: 3,
@ -100,8 +99,7 @@ addLayer("c", {
}, },
}, },
upgrades: { upgrades: {
rows: 2,
cols: 3,
11: { 11: {
title: "Generator of Genericness", title: "Generator of Genericness",
description: "Gain 1 Point every second.", description: "Gain 1 Point every second.",
@ -150,8 +148,7 @@ addLayer("c", {
}, },
}, },
buyables: { buyables: {
rows: 1,
cols: 12,
showRespec: true, showRespec: true,
respec() { // Optional, reset things and give back your currency. Having this function makes a respec button appear 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 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! // This is also non minimal, a Clickable!
clickables: { clickables: {
rows: 1,
cols: 1,
masterButtonPress() { masterButtonPress() {
if (getClickableState(this.layer, 11) == "Borkened...") if (getClickableState(this.layer, 11) == "Borkened...")
player[this.layer].clickables[11] = "Start" player[this.layer].clickables[11] = "Start"
@ -495,8 +491,6 @@ addLayer("a", {
}, },
achievementPopups: true, achievementPopups: true,
achievements: { achievements: {
rows: 2,
cols: 3,
11: { 11: {
image: "discord.png", image: "discord.png",
name: "Get me!", name: "Get me!",

View file

@ -11,8 +11,8 @@ let modInfo = {
// Set your version in num and name // Set your version in num and name
let VERSION = { let VERSION = {
num: "2.π.1", num: "2.4",
name: "Incrementally Updated", name: "Rationalized Edition",
} }
let changelog = `<h1>Changelog:</h1><br> let changelog = `<h1>Changelog:</h1><br>

View file

@ -5,8 +5,8 @@ var scrolled = false;
// Don't change this // Don't change this
const TMT_VERSION = { const TMT_VERSION = {
tmtNum: "2.π.1", tmtNum: "2.4",
tmtName: "Incrementally Updated" tmtName: "Rationalized Edition"
} }
function getResetGain(layer, useType = null) { function getResetGain(layer, useType = null) {

View file

@ -64,6 +64,7 @@ function updateLayers(){
function setupLayer(layer){ function setupLayer(layer){
layers[layer].layer = layer layers[layer].layer = layer
if (layers[layer].upgrades){ if (layers[layer].upgrades){
setRowCol(layers[layer].upgrades)
for (thing in layers[layer].upgrades){ for (thing in layers[layer].upgrades){
if (!isNaN(thing)){ if (!isNaN(thing)){
layers[layer].upgrades[thing].id = thing layers[layer].upgrades[thing].id = thing
@ -84,6 +85,7 @@ function setupLayer(layer){
} }
} }
if (layers[layer].achievements){ if (layers[layer].achievements){
setRowCol(layers[layer].achievements)
for (thing in layers[layer].achievements){ for (thing in layers[layer].achievements){
if (!isNaN(thing)){ if (!isNaN(thing)){
layers[layer].achievements[thing].id = thing layers[layer].achievements[thing].id = thing
@ -94,6 +96,7 @@ function setupLayer(layer){
} }
} }
if (layers[layer].challenges){ if (layers[layer].challenges){
setRowCol(layers[layer].challenges)
for (thing in layers[layer].challenges){ for (thing in layers[layer].challenges){
if (!isNaN(thing)){ if (!isNaN(thing)){
layers[layer].challenges[thing].id = thing layers[layer].challenges[thing].id = thing
@ -108,6 +111,7 @@ function setupLayer(layer){
} }
if (layers[layer].buyables){ if (layers[layer].buyables){
layers[layer].buyables.layer = layer layers[layer].buyables.layer = layer
setRowCol(layers[layer].buyables)
for (thing in layers[layer].buyables){ for (thing in layers[layer].buyables){
if (!isNaN(thing)){ if (!isNaN(thing)){
layers[layer].buyables[thing].id = thing layers[layer].buyables[thing].id = thing
@ -120,6 +124,7 @@ function setupLayer(layer){
if (layers[layer].clickables){ if (layers[layer].clickables){
layers[layer].clickables.layer = layer layers[layer].clickables.layer = layer
setRowCol(layers[layer].clickables)
for (thing in layers[layer].clickables){ for (thing in layers[layer].clickables){
if (!isNaN(thing)){ if (!isNaN(thing)){
layers[layer].clickables[thing].id = thing layers[layer].clickables[thing].id = thing
@ -225,6 +230,19 @@ function readData(data, args=null){
return data; 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){ function someLayerUnlocked(row){
for (layer in ROW_LAYERS[row]) for (layer in ROW_LAYERS[row])
if (player[layer].unlocked) if (player[layer].unlocked)