Add new tree type

Place to get help with not working mods / modding interface.
Post Reply
Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Mon Apr 30, 2018 7:23 am
Contact:

Add new tree type

Post 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?

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Add new tree type

Post 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 

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7351
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Add new tree type

Post 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?
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Add new tree type

Post 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?

Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Mon Apr 30, 2018 7:23 am
Contact:

Re: Add new tree type

Post 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

betrok
Fast Inserter
Fast Inserter
Posts: 101
Joined: Wed Feb 28, 2018 12:08 pm
Contact:

Re: Add new tree type

Post by betrok »

Villfuk02 wrote:I want some more explanation
Check wiki

Villfuk02
Long Handed Inserter
Long Handed Inserter
Posts: 77
Joined: Mon Apr 30, 2018 7:23 am
Contact:

Re: Add new tree type

Post by Villfuk02 »

Thanks!

Post Reply

Return to “Modding help”