I started with MTDad simplev7 and was a little bit annoyed by the schematics tree, and asked myself: why not using default mod tree growing functions ?
So, I started a big rewrite of the mod you can see the work in progress here:
https://github.com/oleastre/simplev7/tree/advanced
To get trees working, I just add saplings as decoration and use minetest.set_gen_notify to get a list of generated saplings, and make them grow in an on_generated function.
As you can see in the code, the growing function always have the same signature: grow(vm_data, area, pos) .
So I'm thinking about adding a new type of decoration that will work roughly like the schematic one, but call a lua defined function instead.
Registration should look like:
Code: Select all
minetest.register_decoration({
deco_type = "function",
place_on = "default:dirt_with_grass",
sidelen = 16,
fill_ratio = 0.17,
biomes = {"forest"},
flags = "place_center_x, place_center_z",
size = {x=4, y=4, z=4}
on_gen = mymod.grow_tree
})
- mymod.grow_tree is my custom function
- size should be the expected area size in which my function can manipulate the content
- flags works like the schematic one to place the decoration position in the given area.
Before I start coding, does it seems interesting ? Any advice ?