It adds roots, branches and smooth tree growth:
https://www.youtube.com/watch?v=3JJ-5R2PjPo
(Growth is fast just for demonstration!)
Screenshots:
GitHub: https://github.com/RichardTry/living_trees
How it works?
For every tree type (apple, pine, etc.) there is a node of roots (can be several: pine_roots_in_dirt, pine_roots_in_sand, etc.) During mapgen (or planting a sapling), every root gets unique L-system string, which generates from axiom for it's tree type. ABM, which runs for every root node, parses its string, and update corresponding node, if it is smaller (or air/leaves), than branch at string (branch getting blocked by other nodes).
Breaking a branch with axe/piston/TNT will recursively break its childs. Leaves will disappear with standart Minetest Game ABM.
Warning: Mapgen and l-string generation parts are not implemented yet!
+ L-system notation
API:
To register a living tree run:
Code: Select all
living_trees.register_tree({name, roots, texture, trunk, leaves})
name — tree's name.
roots — table of node names on which the tree grows.
texture — trunk and branches texture.
leaves — name of leaves node.
Example:
Code: Select all
living_trees.register_tree({
name = "Apple",
roots = {"living_trees:apple_roots"},
texture = "default_tree.png",
trunk = "default:tree",
leaves = "default:leaves"
})
Mapgen,
L-string generation,
Branch adaptation (growing around obstacles).