Page 1 of 1

Add new tree type

Posted: Mon May 21, 2018 1:23 pm
by Villfuk02
I'd like to add a new tree type, but I can't find any way to do so. Also how would I make it generate only in set biomes?

Re: Add new tree type

Posted: Mon May 21, 2018 7:08 pm
by darkfrei
Villfuk02 wrote:I'd like to add a new tree type, but I can't find any way to do so. Also how would I make it generate only in set biomes?
I think it's defined with fields:

Code: Select all

data.raw.tile["red-desert-1"].autoplace.peaks[1].influence = 0.5 
data.raw.tile["red-desert-1"].autoplace.peaks[1].noise_layer = "red-desert-1" 
data.raw.tile["red-desert-1"].autoplace.peaks[1].noise_persistence = 0.7 
data.raw.tile["red-desert-1"].autoplace.peaks[1].octaves_difference = -6 
data.raw.tile["red-desert-1"].autoplace.peaks[1].noise_scale = 3 
data.raw.tile["red-desert-1"].autoplace.peaks[2].aux_optimal = 0.65 
data.raw.tile["red-desert-1"].autoplace.peaks[2].aux_range = 0.05 
data.raw.tile["red-desert-1"].autoplace.peaks[2].aux_max_range = 0.2 
data.raw.tile["red-desert-1"].autoplace.peaks[2].water_optimal = 0.15 
data.raw.tile["red-desert-1"].autoplace.peaks[2].water_range = 0.15 
data.raw.tile["red-desert-1"].autoplace.peaks[2].water_max_range = 0.3 
data.raw.tile["red-desert-1"].autoplace.peaks[3].aux_optimal = 0.85 
data.raw.tile["red-desert-1"].autoplace.peaks[3].aux_range = 0.15 
data.raw.tile["red-desert-1"].autoplace.peaks[3].aux_max_range = 0.3 
data.raw.tile["red-desert-1"].autoplace.peaks[3].water_optimal = 0.275 
data.raw.tile["red-desert-1"].autoplace.peaks[3].water_range = 0.025 
data.raw.tile["red-desert-1"].autoplace.peaks[3].water_max_range = 0.175 

Code: Select all

data.raw.tree["tree-01"].autoplace.peaks[5].influence = 1 
data.raw.tree["tree-01"].autoplace.peaks[5].richness_influence = 0 
data.raw.tree["tree-01"].autoplace.peaks[5].temperature_optimal = 30 
data.raw.tree["tree-01"].autoplace.peaks[5].temperature_range = 5 
data.raw.tree["tree-01"].autoplace.peaks[5].temperature_max_range = 7.5 
data.raw.tree["tree-01"].autoplace.peaks[5].water_optimal = 0.75 
data.raw.tree["tree-01"].autoplace.peaks[5].water_range = 0.25 
data.raw.tree["tree-01"].autoplace.peaks[5].water_max_range = 0.375 
data.raw.tree["tree-01"].autoplace.peaks[6].influence = -0.25 
data.raw.tree["tree-01"].autoplace.peaks[6].richness_influence = 0 
data.raw.tree["tree-01"].autoplace.peaks[6].distance_optimal = 0 
data.raw.tree["tree-01"].autoplace.peaks[6].distance_range = 64 
data.raw.tree["tree-01"].autoplace.peaks[6].distance_max_range = 192 
data.raw.tree["tree-01"].autoplace.peaks[6].distance_top_property_limit = 128 

Re: Add new tree type

Posted: Tue May 22, 2018 9:02 am
by bobingabout
umm... you just listed a bunch of autoplace field values... I don't see how this is relevant to the question.

honestly, I'm not sure I understand the question.

you want to know how to define a tree? Find an existing tree in code, copy it's code, paste it into your mod, edit the values.
or you could get fancy and use table.deepcopy or util.merge to copy the data for you. they're a little more future proof, because when the original changes, it's changes will reflect in your copy.

How knowledgeable are you with factorio modding?

Re: Add new tree type

Posted: Tue May 22, 2018 10:26 am
by darkfrei
bobingabout wrote:umm... you just listed a bunch of autoplace field values... I don't see how this is relevant to the question.

honestly, I'm not sure I understand the question.
If you want to autoplace dry trees in sand or desert only, green trees by green tiles only, how it must be defined?

Re: Add new tree type

Posted: Tue May 22, 2018 3:44 pm
by Villfuk02
I couldn't find anywhere what do all the values in the prefam mean. And I also don't quite understand all the autoplace values :/
AutoplaceSpecification
Table with the following fields:
sharpness :: double
max_probability :: double
placement_density :: uint
richness_base :: double
richness_multiplier :: double
order :: string
peaks :: array of peak (optional): A peak is a table:
influence :: double
max_influence :: double
min_influence :: double
richness_influence :: double
noisePersistence :: double
noise_layer :: string (optional): Prototype name of the noise layer
noise_octaves_difference :: double
d_optimal :: double: d is the dimension name; this attribute may occur multiple times, once for each dimension, every time with a different prefix.
d_range :: double: d is the dimension name.
d_top_property_limit :: double: d is the dimension name.
d_max_range :: double: d is the dimension name.
control :: string (optional): Control prototype name
tile_restriction :: array of restriction (optional): Restriction is a table:
first :: string (optional): Tile prototype name
second :: string (optional): Second prototype name
size_control_multiplier :: double
force :: string
random_probability_penalty :: double
I want some more explanation

I also don't understand the leaf_generation and branch_generation in data.raw for a tree

Re: Add new tree type

Posted: Tue May 22, 2018 5:28 pm
by betrok
Villfuk02 wrote:I want some more explanation
Check wiki

Re: Add new tree type

Posted: Tue May 22, 2018 5:40 pm
by Villfuk02
Thanks!