Page 1 of 1

Auto place tree help

Posted: Tue Jun 20, 2017 8:32 pm
by TheSAguy
Hi,

In my Bio Industries mod, I have the ability for one to plant a seedling that will grow into a tree.


Depending on the terrain type, the seedling has a chance to turn into a tree. This part I have working.

The part I need help with, is what type of tree should grow there - Art of the tree, since certain trees only grow on certain terrain types.
I don't know how to select the tree art/type based on the terrain type. I know it's depending on the terrain temperature and water, but still have no idea how to implement this.

Currently, I have crude code where I've hard coded the tree type based on terrain, but would like to make this dynamic and match the actual Vanilla (and other mods like Alien Biomes)

Can someone please help me convert the code I have below and attached to make my hard coded tree selection dynamic to auto select to correct tree please.

I've attached my full mod and also just the code in question.
Tree Code


Thanks.[/quote]

Re: Auto place tree help

Posted: Wed Jun 21, 2017 10:22 am
by darkfrei
How about make a parser for it? On chunck generated, find all decorative entities and add them to the table with tiles near them.
Export this table to the file.

Re: Auto place tree help

Posted: Wed Jun 21, 2017 3:07 pm
by TheSAguy
darkfrei wrote:How about make a parser for it? On chunck generated, find all decorative entities and add them to the table with tiles near them.
Export this table to the file.
I'm not sure if we're talking about the same thing here darkfrei.

Using my mod, when you plant a seedling it turns into a tree.
The game know what trees to spawn at the beginning of the game, depending on the terrain type. I just need to replicate that...
I know it's got something to do with the temperature and moisture of the tile. The combination of that two gives a range of possible tree entities it can use.

Re: Auto place tree help

Posted: Thu Jun 22, 2017 6:29 am
by darkfrei
TheSAguy wrote: The game know what trees to spawn at the beginning of the game, depending on the terrain type. I just need to replicate that...
I know it's got something to do with the temperature and moisture of the tile. The combination of that two gives a range of possible tree entities it can use.
I think you don't need to plant trees at the beginning of the game. Just collecting information where is which plant and make the same on spawning.

Re: Auto place tree help

Posted: Mon Jun 26, 2017 11:10 pm
by TheSAguy
Darkfrei,

How would I go about reading in the terrain type and tree names into a table that I can output?
This is not something I've done before.

Thanks.

Re: Auto place tree help

Posted: Tue Jun 27, 2017 6:43 am
by darkfrei
On chunck generated iterate x and y coordinate. Now we are making table: if this pair is not in table, then save tile.name and tree.name to the table.

If you want to place new tree, then find this tile in our table and we have all (or not all, but some) trees for this terrain.
For vanilla this table can be exported to the file and added as required file.