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:
## 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.

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -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!",

View file

@ -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 = `<h1>Changelog:</h1><br>

View file

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

View file

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