1
0
Fork 0
mirror of https://github.com/Acamaeda/The-Modding-Tree.git synced 2025-05-15 14:21:07 +00:00

Index.html has lost its relevance!

This commit is contained in:
Acamaeda 2020-10-10 23:26:26 -04:00
parent fc91b3696a
commit 1ff8042fc7
5 changed files with 35 additions and 15 deletions

View file

@ -23,10 +23,12 @@ function updateHotkeys()
}
var ROW_LAYERS = {}
var TREE_LAYERS = {}
function updateLayers(){
LAYERS = Object.keys(layers);
ROW_LAYERS = {}
TREE_LAYERS = {}
for (layer in layers){
layers[layer].layer = layer
if (layers[layer].upgrades){
@ -72,12 +74,21 @@ function updateLayers(){
}
if(!layers[layer].componentStyles) layers[layer].componentStyles = {}
if(layers[layer].symbol === undefined) layers[layer].symbol = layer.charAt(0).toUpperCase() + layer.slice(1)
row = layers[layer].row
if(!ROW_LAYERS[row]) ROW_LAYERS[row] = {}
if(!TREE_LAYERS[row]) TREE_LAYERS[row] = []
ROW_LAYERS[row][layer]=layer;
let position = (layers[layer].position !== undefined ? layers[layer].position : layer)
TREE_LAYERS[row].push({layer: layer, position: position})
}
for (row in TREE_LAYERS) {
TREE_LAYERS[row].sort((a, b) => (a.position > b.position) ? 1 : -1)
}
updateHotkeys()
}
@ -94,6 +105,13 @@ function readData(data, args=null){
return data;
}
function someLayerUnlocked(row){
for (layer in ROW_LAYERS[row])
if (player[layer].unl)
return true
return false
}
// This isn't worth making a .ts file over
const UP = 1
const DOWN = 2

View file

@ -1,6 +1,8 @@
addLayer("c", {
layer: "c", // This is assigned automatically, both to the layer and all upgrades, etc. Shown here so you know about it
name: "Candies", // This is optional, only used in a few places, If absent it just uses the layer id.
symbol: "C", // This appears on the layer's node. Default is the id with the first letter capitalized
position: 0, // Horizontal position within a row. By default it uses the layer id and sorts in alphabetical order
startData() { return {
unl: true,
points: new Decimal(0),
@ -346,4 +348,3 @@ addLayer("f", {
},
)