dofile(minetest.get_modpath("moretrees").."/tree_models.lua")
dofile(minetest.get_modpath("moretrees").."/biome_defs.lua")
+plantslib:register_generate_plant(moretrees.apple_tree_biome, moretrees.apple_tree_model)
+plantslib:register_generate_plant(moretrees.oak_biome, moretrees.oak_model)
+plantslib:register_generate_plant(moretrees.sequoia_biome, moretrees.sequoia_model)
+plantslib:register_generate_plant(moretrees.palm_biome, moretrees.palm_model)
+plantslib:register_generate_plant(moretrees.pine_biome, moretrees.pine_model)
+plantslib:register_generate_plant(moretrees.rubber_tree_biome, moretrees.rubber_tree_model)
+plantslib:register_generate_plant(moretrees.willow_biome, moretrees.willow_model)
+
+plantslib:register_generate_plant(moretrees.birch_biome, "moretrees:grow_birch")
+plantslib:register_generate_plant(moretrees.spruce_biome, "moretrees:grow_spruce")
plantslib:register_generate_plant(moretrees.jungletree_biome, "moretrees:grow_jungletree")
plantslib:register_generate_plant(moretrees.conifer_biome, "moretrees:grow_conifer")
---plantslib:register_generate_plant(moretrees.palm_biome, moretrees.palm_model)
+-- These three lines replace default trees with beech
+-- Enable them if you want but be warned - due to serious bugs in the speed
+-- of the engine's map generator/loader, doing so will slow it WAY down.
---------------------------
--- Other stuff
---
--- for backward compatibility with previous mods/code, jungle trees and
--- firs ("conifers") L-Systems definitions are established separately.
---
---------------------------
+--[[
+minetest.register_alias("mapgen_tree", "air")
+minetest.register_alias("mapgen_leaves", "air")
+plantslib:register_generate_plant(moretrees.beech_biome, moretrees.beech_model)
+]]--
+
+-- Code to spawn a birch tree
+
+function moretrees:grow_birch(pos)
+ if math.random(1,2) == 1 then
+ minetest.env:spawn_tree(pos, moretrees.birch_model1)
+ else
+ minetest.env:spawn_tree(pos, moretrees.birch_model2)
+ end
+end
+
+-- Code to spawn a spruce tree
+
+function moretrees:grow_spruce(pos)
+ if math.random(1,2) == 1 then
+ minetest.env:spawn_tree(pos, moretrees.spruce_model1)
+ else
+ minetest.env:spawn_tree(pos, moretrees.spruce_model2)
+ end
+end
--- Code that spawns jungle trees and firs ("conifers")
+-- Code that spawns jungle trees and firs ("conifer")
moretrees.jt_axiom1 = "FFFA"
moretrees.jt_rules_a1 = "FFF[&&-FBf[&&&Ff]^^^Ff][&&+FBFf[&&&FFf]^^^Ff][&&---FBFf[&&&Ff]^^^Ff][&&+++FBFf[&&&Ff]^^^Ff]F/A"
-beech_model={
-axiom="FFFFFBFB",
-rules_a="[&&&GGF[++^Fd][--&Fd]//Fd[+^Fd][--&Fd]]////[&&&GGF[++^Fd][--&Fd]//Fd[+^Fd][--&Fd]]////[&&&GGF[++^Fd][--&Fd]//Fd[+^Fd][--&Fdd]]",
-rules_b="[&&&F[++^Fd][--&d]//d[+^d][--&d]]////[&&&F[++^Fd][--&d]//d[+^d][--&d]]////[&&&F[++^Fd][--&Fd]//d[+^d][--&d]]",
-rules_c="/",
-rules_d="F",
-trunk="moretrees:beech_trunk",
-leaves="moretrees:beech_leaves",
-angle=30,
-iterations=2,
-random_level=0,
-trunk_type="single";
-thin_branches=true;
+moretrees.beech_model={
+ axiom="FFFFFBFB",
+ rules_a="[&&&GGF[++^Fd][--&Fd]//Fd[+^Fd][--&Fd]]////[&&&GGF[++^Fd][--&Fd]//Fd[+^Fd][--&Fd]]////[&&&GGF[++^Fd][--&Fd]//Fd[+^Fd][--&Fdd]]",
+ rules_b="[&&&F[++^Fd][--&d]//d[+^d][--&d]]////[&&&F[++^Fd][--&d]//d[+^d][--&d]]////[&&&F[++^Fd][--&Fd]//d[+^d][--&d]]",
+ rules_c="/",
+ rules_d="F",
+ trunk="moretrees:beech_trunk",
+ leaves="moretrees:beech_leaves",
+ angle=30,
+ iterations=2,
+ random_level=0,
+ trunk_type="single";
+ thin_branches=true;
}
-apple_tree_model={
-axiom="FFFFFAFFBF",
-rules_a="[&&&FFFFF&&FFFF][&&&++++FFFFF&&FFFF][&&&----FFFFF&&FFFF]",
-rules_b="[&&&++FFFFF&&FFFF][&&&--FFFFF&&FFFF][&&&------FFFFF&&FFFF]",
-trunk="moretrees:apple_tree_trunk",
-leaves="moretrees:apple_tree_leaves",
-angle=30,
-iterations=2,
-random_level=0,
-trunk_type="single",
-thin_branches=true;
-fruit="default:apple",
-fruit_chance=15,
+moretrees.apple_tree_model={
+ axiom="FFFFFAFFBF",
+ rules_a="[&&&FFFFF&&FFFF][&&&++++FFFFF&&FFFF][&&&----FFFFF&&FFFF]",
+ rules_b="[&&&++FFFFF&&FFFF][&&&--FFFFF&&FFFF][&&&------FFFFF&&FFFF]",
+ trunk="moretrees:apple_tree_trunk",
+ leaves="moretrees:apple_tree_leaves",
+ angle=30,
+ iterations=2,
+ random_level=0,
+ trunk_type="single",
+ thin_branches=true;
+ fruit="default:apple",
+ fruit_chance=15,
}
-oak_model={
-axiom="FFFFFFA",
-rules_a="[&FFBFA]////[&BFFFA]////[&FBFFA]",
-rules_b="[&FFFA]////[&FFFA]////[&FFFA]",
-trunk="moretrees:oak_trunk",
-leaves="moretrees:oak_leaves",
-angle=30,
-iterations=5,
-random_level=2,
-trunk_type="crossed";
-thin_branches=false;
-fruit="moretrees:acorn",
-fruit_chance=3,
+moretrees.oak_model={
+ axiom="FFFFFFA",
+ rules_a="[&FFBFA]////[&BFFFA]////[&FBFFA]",
+ rules_b="[&FFFA]////[&FFFA]////[&FFFA]",
+ trunk="moretrees:oak_trunk",
+ leaves="moretrees:oak_leaves",
+ angle=30,
+ iterations=5,
+ random_level=2,
+ trunk_type="crossed";
+ thin_branches=false;
+ fruit="moretrees:acorn",
+ fruit_chance=3,
}
-sequoia_model={
-axiom="FFFFFFFFFFddccA///cccFddcFA///ddFcFA/cFFddFcdBddd/A/ccdcddd/ccAddddcFBcccAccFdFcFBcccc/BFdFFcFFdcccc/B",
-rules_a="[&&&GGF[++^FFdd][--&Fddd]//Fdd[+^Fd][--&Fdd]]////[&&&GGF[++^FFdd][--&Fddd]//Fdd[+^Fd][--&Fdd]]////[&&&GGF[++^FFdd][--&Fddd]//Fdd[+^Fd][--&Fdd]]",
-rules_b="[&&&GGF[++^Fdd][--&Fdd]//dd[+^d][--&Fd]]////[&&&GGF[++^Fdd][--&Fdd]//dd[+^d][--&Fd]]////[&&&GGF[++^Fdd][--&Fdd]//dd[+^d][--&Fd]]",
-rules_c="/",
-rules_d="F",
-trunk="moretrees:sequoia_trunk",
-leaves="moretrees:sequoia_leaves",
-angle=30,
-iterations=2,
-random_level=0,
-trunk_type="crossed",
-thin_branches=true
+moretrees.sequoia_model={
+ axiom="FFFFFFFFFFddccA///cccFddcFA///ddFcFA/cFFddFcdBddd/A/ccdcddd/ccAddddcFBcccAccFdFcFBcccc/BFdFFcFFdcccc/B",
+ rules_a="[&&&GGF[++^FFdd][--&Fddd]//Fdd[+^Fd][--&Fdd]]////[&&&GGF[++^FFdd][--&Fddd]//Fdd[+^Fd][--&Fdd]]////[&&&GGF[++^FFdd][--&Fddd]//Fdd[+^Fd][--&Fdd]]",
+ rules_b="[&&&GGF[++^Fdd][--&Fdd]//dd[+^d][--&Fd]]////[&&&GGF[++^Fdd][--&Fdd]//dd[+^d][--&Fd]]////[&&&GGF[++^Fdd][--&Fdd]//dd[+^d][--&Fd]]",
+ rules_c="/",
+ rules_d="F",
+ trunk="moretrees:sequoia_trunk",
+ leaves="moretrees:sequoia_leaves",
+ angle=30,
+ iterations=2,
+ random_level=0,
+ trunk_type="crossed",
+ thin_branches=true
}
-birch_model1={
-axiom="FFFFFdddccA/FFFFFFcA/FFFFFFcB",
-rules_a="[&&&dddd^^ddddddd][&&&---dddd^^ddddddd][&&&+++dddd^^ddddddd][&&&++++++dddd^^ddddddd]",
-rules_b="[&&&ddd^^ddddd][&&&---ddd^^ddddd][&&&+++ddd^^ddddd][&&&++++++ddd^^ddddd]",
-rules_c="/",
-rules_d="F",
-trunk="moretrees:birch_trunk",
-leaves="moretrees:birch_leaves",
-angle=30,
-iterations=2,
-random_level=0,
-trunk_type="single",
-thin_branches=true
+moretrees.birch_model1={
+ axiom="FFFFFdddccA/FFFFFFcA/FFFFFFcB",
+ rules_a="[&&&dddd^^ddddddd][&&&---dddd^^ddddddd][&&&+++dddd^^ddddddd][&&&++++++dddd^^ddddddd]",
+ rules_b="[&&&ddd^^ddddd][&&&---ddd^^ddddd][&&&+++ddd^^ddddd][&&&++++++ddd^^ddddd]",
+ rules_c="/",
+ rules_d="F",
+ trunk="moretrees:birch_trunk",
+ leaves="moretrees:birch_leaves",
+ angle=30,
+ iterations=2,
+ random_level=0,
+ trunk_type="single",
+ thin_branches=true
}
-birch_model2={
-axiom="FFFdddccA/FFFFFccA/FFFFFccB",
-rules_a="[&&&dFFF^^FFFdd][&&&---dFFF^^FFFdd][&&&+++dFFF^^FFFdd][&&&++++++dFFF^^FFFdd]",
-rules_b="[&&&dFF^^FFFd][&&&---dFFF^^FFFd][&&&+++dFF^^FFFd][&&&++++++dFF^^FFFd]",
-rules_c="/",
-rules_d="F",
-trunk="moretrees:birch_trunk",
-leaves="moretrees:birch_leaves",
-angle=30,
-iterations=2,
-random_level=0,
-trunk_type="single",
-thin_branches=true
+moretrees.birch_model2={
+ axiom="FFFdddccA/FFFFFccA/FFFFFccB",
+ rules_a="[&&&dFFF^^FFFdd][&&&---dFFF^^FFFdd][&&&+++dFFF^^FFFdd][&&&++++++dFFF^^FFFdd]",
+ rules_b="[&&&dFF^^FFFd][&&&---dFFF^^FFFd][&&&+++dFF^^FFFd][&&&++++++dFF^^FFFd]",
+ rules_c="/",
+ rules_d="F",
+ trunk="moretrees:birch_trunk",
+ leaves="moretrees:birch_leaves",
+ angle=30,
+ iterations=2,
+ random_level=0,
+ trunk_type="single",
+ thin_branches=true
}
-palm_model={
-axiom="FFccc&FFFFFdddFA//A//A//A//A//A",
-rules_a="[&fb&bbb[++f--&ffff&ff][--f++&ffff&ff]&ffff&bbbb&b]",
-rules_b="f",
-rules_c="/",
-rules_d="F",
-trunk="moretrees:palm_trunk",
-leaves="moretrees:palm_leaves",
-angle=30,
-iterations=2,
-random_level=0,
-trunk_type="single",
-thin_branches=true,
-fruit="moretrees:coconut",
-fruit_chance=0
+moretrees.palm_model={
+ axiom="FFccc&FFFFFdddFA//A//A//A//A//A",
+ rules_a="[&fb&bbb[++f--&ffff&ff][--f++&ffff&ff]&ffff&bbbb&b]",
+ rules_b="f",
+ rules_c="/",
+ rules_d="F",
+ trunk="moretrees:palm_trunk",
+ leaves="moretrees:palm_leaves",
+ angle=30,
+ iterations=2,
+ random_level=0,
+ trunk_type="single",
+ thin_branches=true,
+ fruit="moretrees:coconut",
+ fruit_chance=0
}
-spruce_model1={
-axiom="FFFFFAFFFFFFBFFFFFFCFFFFFFDFFFFFF[&&&F^^FF][&&&++F^^FF][&&&++++F^^FF][&&&++++++F^^FF][&&&--F^^FF][&&&----F^^FF][FFFFf]",
-rules_a="[&&&FFFFFF^^FFF][&&&++FFFFFF^^FFF][&&&++++FFFFFF^^FFF][&&&++++++FFFFFF^^FFF][&&&--FFFFFF^^FFF][&&&----FFFFFF^^FFF]",
-rules_b="[&&&FFFFF^^FFF][&&&++FFFFF^^FFF][&&&++++FFFFF^^FFF][&&&++++++FFFFF^^FFF][&&&--FFFFF^^FFF][&&&----FFFFF^^FFF]",
-rules_c="[&&&FFFF^^FFF][&&&++FFFF^^FFF][&&&++++FFFF^^FFF][&&&++++++FFFF^^FFF][&&&--FFFF^^FFF][&&&----FFFF^^FFF]",
-rules_d="[&&&FFF^^FFF][&&&++FFF^^FFF][&&&++++FFF^^FFF][&&&++++++FFF^^FFF][&&&--FFF^^FFF][&&&----FFF^^FFF]",
-trunk="moretrees:spruce_trunk",
-leaves="moretrees:spruce_leaves",
-angle=30,
-iterations=2,
-random_level=0,
-trunk_type="crossed",
-thin_branches=true,
-fruit="moretrees:cone",
-fruit_chance=8
+moretrees.spruce_model1={
+ axiom="FFFFFAFFFFFFBFFFFFFCFFFFFFDFFFFFF[&&&F^^FF][&&&++F^^FF][&&&++++F^^FF][&&&++++++F^^FF][&&&--F^^FF][&&&----F^^FF][FFFFf]",
+ rules_a="[&&&FFFFFF^^FFF][&&&++FFFFFF^^FFF][&&&++++FFFFFF^^FFF][&&&++++++FFFFFF^^FFF][&&&--FFFFFF^^FFF][&&&----FFFFFF^^FFF]",
+ rules_b="[&&&FFFFF^^FFF][&&&++FFFFF^^FFF][&&&++++FFFFF^^FFF][&&&++++++FFFFF^^FFF][&&&--FFFFF^^FFF][&&&----FFFFF^^FFF]",
+ rules_c="[&&&FFFF^^FFF][&&&++FFFF^^FFF][&&&++++FFFF^^FFF][&&&++++++FFFF^^FFF][&&&--FFFF^^FFF][&&&----FFFF^^FFF]",
+ rules_d="[&&&FFF^^FFF][&&&++FFF^^FFF][&&&++++FFF^^FFF][&&&++++++FFF^^FFF][&&&--FFF^^FFF][&&&----FFF^^FFF]",
+ trunk="moretrees:spruce_trunk",
+ leaves="moretrees:spruce_leaves",
+ angle=30,
+ iterations=2,
+ random_level=0,
+ trunk_type="crossed",
+ thin_branches=true,
+ fruit="moretrees:cone",
+ fruit_chance=8
}
-spruce_model2={
-axiom="FFFFFFBFFFFFFCFFFFFFDFFFFFF[&&&F^^FF][&&&++F^^FF][&&&++++F^^FF][&&&++++++F^^FF][&&&--F^^FF][&&&----F^^FF][FFFFf]",
-rules_b="[&&&FFFFF^^FFF][&&&++FFFFF^^FFF][&&&++++FFFFF^^FFF][&&&++++++FFFFF^^FFF][&&&--FFFFF^^FFF][&&&----FFFFF^^FFF]",
-rules_c="[&&&FFFF^^FFF][&&&++FFFF^^FFF][&&&++++FFFF^^FFF][&&&++++++FFFF^^FFF][&&&--FFFF^^FFF][&&&----FFFF^^FFF]",
-rules_d="[&&&FFF^^FFF][&&&++FFF^^FFF][&&&++++FFF^^FFF][&&&++++++FFF^^FFF][&&&--FFF^^FFF][&&&----FFF^^FFF]",
-trunk="moretrees:spruce_trunk",
-leaves="moretrees:spruce_leaves",
-angle=30,
-iterations=2,
-random_level=0,
-trunk_type="crossed",
-thin_branches=true,
-fruit="moretrees:cone",
-fruit_chance=8
+moretrees.spruce_model2={
+ axiom="FFFFFFBFFFFFFCFFFFFFDFFFFFF[&&&F^^FF][&&&++F^^FF][&&&++++F^^FF][&&&++++++F^^FF][&&&--F^^FF][&&&----F^^FF][FFFFf]",
+ rules_b="[&&&FFFFF^^FFF][&&&++FFFFF^^FFF][&&&++++FFFFF^^FFF][&&&++++++FFFFF^^FFF][&&&--FFFFF^^FFF][&&&----FFFFF^^FFF]",
+ rules_c="[&&&FFFF^^FFF][&&&++FFFF^^FFF][&&&++++FFFF^^FFF][&&&++++++FFFF^^FFF][&&&--FFFF^^FFF][&&&----FFFF^^FFF]",
+ rules_d="[&&&FFF^^FFF][&&&++FFF^^FFF][&&&++++FFF^^FFF][&&&++++++FFF^^FFF][&&&--FFF^^FFF][&&&----FFF^^FFF]",
+ trunk="moretrees:spruce_trunk",
+ leaves="moretrees:spruce_leaves",
+ angle=30,
+ iterations=2,
+ random_level=0,
+ trunk_type="crossed",
+ thin_branches=true,
+ fruit="moretrees:cone",
+ fruit_chance=8
}
-pine_model={
-axiom="FFFFFcccdddB///cFdFB////cFdFB///cFdFB///cFdFA///cFdFA///cFdFB[FF]f",
-rules_a="[&&&TTTT[++^TFdd][--&TFd]//Tdd[+^Fd][--&Fdd]]",
-rules_b="[&&&TTT[++^Fdd][--&Fdd]//dd[+^d][--&Fd]]",
-rules_c="/",
-rules_d="F",
-trunk="moretrees:pine_trunk",
-leaves="moretrees:pine_leaves",
-angle=30,
-iterations=2,
-random_level=0,
-trunk_type="single",
-thin_branches=true,
-fruit="moretrees:pine_cone",
-fruit_chance=8
+moretrees.pine_model={
+ axiom="FFFFFcccdddB///cFdFB////cFdFB///cFdFB///cFdFA///cFdFA///cFdFB[FF]f",
+ rules_a="[&&&TTTT[++^TFdd][--&TFd]//Tdd[+^Fd][--&Fdd]]",
+ rules_b="[&&&TTT[++^Fdd][--&Fdd]//dd[+^d][--&Fd]]",
+ rules_c="/",
+ rules_d="F",
+ trunk="moretrees:pine_trunk",
+ leaves="moretrees:pine_leaves",
+ angle=30,
+ iterations=2,
+ random_level=0,
+ trunk_type="single",
+ thin_branches=true,
+ fruit="moretrees:pine_cone",
+ fruit_chance=8
}
-willow_model={
-axiom="FFFFFFFFccA",
-rules_a="[&FF&FFFF&&F&FFFFFFFdddd][**&FF&FFFF&&F&FFFFFFFdddd][//&FF&FFFF&&F&FFFFFFFdddd][////&FF&FFFF&&F&FFFFFFFdddd][//////&FF&FFFF&&F&FFFFFFFdddd][////////&FF&FFFF&&F&FFFFFFFdddd]",
-rules_c="/",
-rules_d="F",
-trunk="moretrees:willow_trunk",
-leaves="moretrees:willow_leaves",
-angle=30,
-iterations=2,
-random_level=0,
-trunk_type="crossed",
-thin_branches=true
+moretrees.willow_model={
+ axiom="FFFFFFFFccA",
+ rules_a="[&FF&FFFF&&F&FFFFFFFdddd][**&FF&FFFF&&F&FFFFFFFdddd][//&FF&FFFF&&F&FFFFFFFdddd][////&FF&FFFF&&F&FFFFFFFdddd][//////&FF&FFFF&&F&FFFFFFFdddd][////////&FF&FFFF&&F&FFFFFFFdddd]",
+ rules_c="/",
+ rules_d="F",
+ trunk="moretrees:willow_trunk",
+ leaves="moretrees:willow_leaves",
+ angle=30,
+ iterations=2,
+ random_level=0,
+ trunk_type="crossed",
+ thin_branches=true
}
-rubber_tree={
-axiom="FFFFA",
-rules_a="[&FFBFA]////[&BFFFA]////[&FBFFA]",
-rules_b="[&FFA]////[&FFA]////[&FFA]",
-trunk="moretrees:rubber_tree_trunk",
-leaves="moretrees:rubber_tree_leaves",
-angle=35,
-iterations=3,
-random_level=1,
-trunk_type="double",
-thin_branches=true
+moretrees.rubber_tree_model={
+ axiom="FFFFA",
+ rules_a="[&FFBFA]////[&BFFFA]////[&FBFFA]",
+ rules_b="[&FFA]////[&FFA]////[&FFA]",
+ trunk="moretrees:rubber_tree_trunk",
+ leaves="moretrees:rubber_tree_leaves",
+ angle=35,
+ iterations=3,
+ random_level=1,
+ trunk_type="double",
+ thin_branches=true
}
moretrees.jungletree_model={
angle=45,
iterations=7,
random_level=5,
- thin_trunks=true
+ trunk_type="single",
+ thin_branches=true
}