I tried making a tree but the only thing i see is the first layer

proof here: https://raw.githack.com/ohmyshapez/The-Modding-Tree/master/index.html

1 Like

Looking at the code, you only have the one layer in your layers.js, and it doesn’t appear you have any other layer files elsewhere in the repo. What are you expecting to see?

2 Likes

do i have to make a seperate layers.js file or do i have to add , or what?

1 Like

tell me. pls.

1 Like

I personally like separating each layer into it’s own file, but it’s not required. You can stick as many addLayer calls into the layers.js file as you want.

If you do create a file per-layer, make sure to load the layer - there should be an array of mod files to load in modInfo

2 Likes

ok, now. how do i make custom trees?

1 Like
2 Likes

yeah where do you put the tree not like how to make one

1 Like

you add an array to the layer’s tabFormat, where the first element is “tree” and the second element is which nodes you want it to include. You can look at the tree in js/tree.js for reference

2 Likes

i dont see any tree. there is treeLayout but idk what that does

1 Like

layoutInfo.treeLayout is for overriding the nodes you want displayed in the default tree - you typically won’t need that, as it’ll use a TREE_LAYERS object instead, which is calculated by iterating over each layer and looking at the row and position it wants to be on.

2 Likes

well where do i put my tree

1 Like

If you’re creating a new tree, go to the layer you want it to appear on and add the tree to the layer’s tabFormat, in the format ["tree", ARRAY_OF_ARRAY_OF_LAYERS] where that second argument is an array of rows, and each row is an array of layer IDs. You’ll need to create the tabFormat property if you’re currently using the default tabFormat.

2 Likes

theres a function in it’s place.
tabFormat: [[“tree”, function() {return (layoutInfo.treeLayout ? layoutInfo.treeLayout : TREE_LAYERS)}]],

1 Like

theres a function no array thing
tabFormat: [[“tree”, function() {return (layoutInfo.treeLayout ? layoutInfo.treeLayout : TREE_LAYERS)}]],

1 Like

That’s for the default one. TREE_LAYERS is an array of arrays of nodes that gets generated automatically from the layers added to the mod (or you can override it with your own array of arrays of nodes by setting layoutInfo.treeLayout)

2 Likes

how do you set layout info.tree layout

1 Like

How do you do what? Add layers to the mod? Set layoutInfo.treeLayout?

2 Likes

where to put tree while there is tree function bla bla
also, i reached reply limit and need to wait 20h. so i made this to continue.

1 Like

I’m not sure what you mean by tree function. To summarize what I’ve been telling you:

There is an existing tree in tree.js that appears on the left side. If you want to add new nodes to that tree, you typically will want to create new layers (in layers.js to keep it simple) and they will be AUTOMATICALLY added to that tree based on their row and position properties (see [this docs page](The-Modding-Tree/layer-features.md at master · Acamaeda/The-Modding-Tree · GitHub for those and the other tree/node related properties). You can technically manually set the nodes for the tree, but if all you are trying to do is add a new layer and have it appear on the tree, you won’t need to change a single thing about the tree code - just create the new layer (you can literally copy the code you have for the first layer, then modify from there) and make sure it has the row and position you want.

If you want to create a NEW tree, you’ll need to make a custom layer display using tabFormat. See this docs page on how to do that. The specific code for this NEW TREE will look like ["tree", ARRAY_OF_ARRAY_OF_LAYERS]. But again, that is only for a NEW TREE.

1 Like