Vanessa's plantlife modpack
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

555 lines
21KB

  1. -- Code by Mossmanikin, Neuromancer, and others
  2. local function clone_node(name)
  3. local node2 = {}
  4. local node = minetest.registered_nodes[name]
  5. for k,v in pairs(node) do
  6. node2[k]=v
  7. end
  8. return node2
  9. end
  10. -----------------------------------------------------------------------------------------------
  11. -- TWiGS
  12. -----------------------------------------------------------------------------------------------
  13. abstract_trunks.place_twig = function(pos)
  14. local twig_size = math.random(1,27)
  15. local right_here = {x=pos.x , y=pos.y+1, z=pos.z }
  16. local north = {x=pos.x , y=pos.y+1, z=pos.z+1}
  17. local north_east = {x=pos.x+1, y=pos.y+1, z=pos.z+1}
  18. local east = {x=pos.x+1, y=pos.y+1, z=pos.z }
  19. local south_east = {x=pos.x+1, y=pos.y+1, z=pos.z-1}
  20. local south = {x=pos.x , y=pos.y+1, z=pos.z-1}
  21. local south_west = {x=pos.x-1, y=pos.y+1, z=pos.z-1}
  22. local west = {x=pos.x-1, y=pos.y+1, z=pos.z }
  23. local north_west = {x=pos.x-1, y=pos.y+1, z=pos.z+1}
  24. local node_here = minetest.get_node(right_here)
  25. local node_north = minetest.get_node(north)
  26. local node_n_e = minetest.get_node(north_east)
  27. local node_east = minetest.get_node(east)
  28. local node_s_e = minetest.get_node(south_east)
  29. local node_south = minetest.get_node(south)
  30. local node_s_w = minetest.get_node(south_west)
  31. local node_west = minetest.get_node(west)
  32. local node_n_w = minetest.get_node(north_west)
  33. -- small twigs
  34. if twig_size <= 16 then
  35. minetest.set_node(right_here, {name="trunks:twig_"..math.random(1,4), param2=math.random(0,3)})
  36. end
  37. -- big twigs
  38. if Big_Twigs == true then
  39. -- big twig 1
  40. if twig_size == 17 then
  41. if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1}).name].buildable_to
  42. or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name].buildable_to) then
  43. if minetest.registered_nodes[node_here.name].buildable_to then
  44. minetest.set_node(right_here, {name="trunks:twig_5"})
  45. end
  46. if minetest.registered_nodes[node_n_e.name].buildable_to then
  47. minetest.set_node(north_east, {name="trunks:twig_7"})
  48. end
  49. if minetest.registered_nodes[node_east.name].buildable_to then
  50. minetest.set_node(east, {name="trunks:twig_8"})
  51. end
  52. end
  53. elseif twig_size == 18 then
  54. if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to
  55. or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name].buildable_to) then
  56. if minetest.registered_nodes[node_here.name].buildable_to then
  57. minetest.set_node(right_here, {name="trunks:twig_5", param2=1})
  58. end
  59. if minetest.registered_nodes[node_s_e.name].buildable_to then
  60. minetest.set_node(south_east, {name="trunks:twig_7", param2=1})
  61. end
  62. if minetest.registered_nodes[node_south.name].buildable_to then
  63. minetest.set_node(south, {name="trunks:twig_8", param2=1})
  64. end
  65. end
  66. elseif twig_size == 19 then
  67. if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to
  68. or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name].buildable_to) then
  69. if minetest.registered_nodes[node_here.name].buildable_to then
  70. minetest.set_node(right_here, {name="trunks:twig_5", param2=2})
  71. end
  72. if minetest.registered_nodes[node_s_w.name].buildable_to then
  73. minetest.set_node(south_west, {name="trunks:twig_7", param2=2})
  74. end
  75. if minetest.registered_nodes[node_west.name].buildable_to then
  76. minetest.set_node(west, {name="trunks:twig_8", param2=2})
  77. end
  78. end
  79. elseif twig_size == 20 then
  80. if not (minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1}).name].buildable_to
  81. or minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name].buildable_to) then
  82. if minetest.registered_nodes[node_here.name].buildable_to then
  83. minetest.set_node(right_here, {name="trunks:twig_5", param2=3})
  84. end
  85. if minetest.registered_nodes[node_n_w.name].buildable_to then
  86. minetest.set_node(north_west, {name="trunks:twig_7", param2=3})
  87. end
  88. if minetest.registered_nodes[node_north.name].buildable_to then
  89. minetest.set_node(north, {name="trunks:twig_8", param2=3})
  90. end
  91. end
  92. -- big twig 2
  93. elseif twig_size == 21 then
  94. if not (minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}).name].buildable_to
  95. or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z+1}).name].buildable_to) then
  96. if minetest.registered_nodes[node_here.name].buildable_to then
  97. minetest.set_node(right_here, {name="trunks:twig_9"})
  98. end
  99. if minetest.registered_nodes[node_north.name].buildable_to then
  100. minetest.set_node(north, {name="trunks:twig_10"})
  101. end
  102. if minetest.registered_nodes[node_n_e.name].buildable_to then
  103. minetest.set_node(north_east, {name="trunks:twig_11"})
  104. end
  105. end
  106. elseif twig_size == 22 then
  107. if not (minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}).name].buildable_to
  108. or minetest.registered_nodes[minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z-1}).name].buildable_to) then
  109. if minetest.registered_nodes[node_here.name].buildable_to then
  110. minetest.set_node(right_here, {name="trunks:twig_9", param2=1})
  111. end
  112. if minetest.registered_nodes[node_east.name].buildable_to then
  113. minetest.set_node(east, {name="trunks:twig_10", param2=1})
  114. end
  115. if minetest.registered_nodes[node_s_e.name].buildable_to then
  116. minetest.set_node(south_east, {name="trunks:twig_11", param2=1})
  117. end
  118. end
  119. elseif twig_size == 23 then
  120. if not (minetest.registered_nodes[minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}).name].buildable_to
  121. or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z-1}).name].buildable_to) then
  122. if minetest.registered_nodes[node_here.name].buildable_to then
  123. minetest.set_node(right_here, {name="trunks:twig_9", param2=2})
  124. end
  125. if minetest.registered_nodes[node_south.name].buildable_to then
  126. minetest.set_node(south, {name="trunks:twig_10", param2=2})
  127. end
  128. if minetest.registered_nodes[node_s_w.name].buildable_to then
  129. minetest.set_node(south_west, {name="trunks:twig_11", param2=2})
  130. end
  131. end
  132. elseif twig_size == 24 then
  133. if not (minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}).name].buildable_to
  134. or minetest.registered_nodes[minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z+1}).name].buildable_to) then
  135. if minetest.registered_nodes[node_here.name].buildable_to then
  136. minetest.set_node(right_here, {name="trunks:twig_9", param2=3})
  137. end
  138. if minetest.registered_nodes[node_west.name].buildable_to then
  139. minetest.set_node(west, {name="trunks:twig_10", param2=3})
  140. end
  141. if minetest.registered_nodes[node_n_w.name].buildable_to then
  142. minetest.set_node(north_west, {name="trunks:twig_11", param2=3})
  143. end
  144. end
  145. elseif twig_size <= 25 then
  146. minetest.set_node(right_here, {name="trunks:twig_"..math.random(12,13), param2=math.random(0,3)})
  147. end
  148. end
  149. end
  150. if Twigs_on_ground == true then
  151. biome_lib:register_generate_plant({
  152. surface = {"default:dirt_with_grass"},
  153. max_count = Twigs_on_ground_Max_Count,
  154. rarity = Twigs_on_ground_Rarity,
  155. min_elevation = 1,
  156. max_elevation = 40,
  157. near_nodes = {"group:tree","ferns:fern_03","ferns:fern_02","ferns:fern_01"},
  158. near_nodes_size = 3,
  159. near_nodes_vertical = 1,
  160. near_nodes_count = 1,
  161. plantlife_limit = -0.9,
  162. },
  163. abstract_trunks.place_twig
  164. )
  165. end
  166. if Twigs_on_water == true then
  167. biome_lib:register_generate_plant({
  168. surface = {"default:water_source"},
  169. max_count = Twigs_on_water_Max_Count,
  170. rarity = Twigs_on_water_Rarity,
  171. min_elevation = 1,
  172. max_elevation = 40,
  173. near_nodes = {"group:tree"},
  174. near_nodes_size = 3,
  175. near_nodes_vertical = 1,
  176. near_nodes_count = 1,
  177. plantlife_limit = -0.9,
  178. },
  179. abstract_trunks.place_twig
  180. )
  181. end
  182. -----------------------------------------------------------------------------------------------
  183. -- TRuNKS
  184. -----------------------------------------------------------------------------------------------
  185. local TRuNKS = {
  186. -- MoD TRuNK NR
  187. {"default", "tree", 1},
  188. {"default", "jungletree", 2},
  189. {"trees", "tree_conifer", 3},
  190. {"trees", "tree_mangrove", 4},
  191. {"trees", "tree_palm", 5},
  192. {"moretrees", "apple_tree_trunk", 6},
  193. {"moretrees", "beech_trunk", 7},
  194. {"moretrees", "birch_trunk", 8},
  195. {"moretrees", "fir_trunk", 9},
  196. {"moretrees", "oak_trunk", 10},
  197. {"moretrees", "palm_trunk", 11},
  198. {"moretrees", "pine_trunk", 12},
  199. {"moretrees", "rubber_tree_trunk", 13},
  200. {"moretrees", "rubber_tree_trunk_empty", 14},
  201. {"moretrees", "sequoia_trunk", 15},
  202. {"moretrees", "spruce_trunk", 16},
  203. {"moretrees", "willow_trunk", 17},
  204. }
  205. if Horizontal_Trunks == true then -- see settings.txt
  206. for i in pairs(TRuNKS) do
  207. local MoD = TRuNKS[i][1]
  208. local TRuNK = TRuNKS[i][2]
  209. local NR = TRuNKS[i][3]
  210. local trunkname = MoD..":"..TRuNK
  211. if minetest.get_modpath(MoD) ~= nil
  212. and NR < 6 -- moretrees trunks allready have facedir
  213. and minetest.registered_nodes[trunkname] then -- the node being called exists.
  214. temptrunk = clone_node(trunkname)
  215. temptrunk.paramtype2 = "facedir"
  216. minetest.register_node(":"..trunkname, temptrunk)
  217. end
  218. end
  219. end
  220. abstract_trunks.place_trunk = function(pos)
  221. local right_here = {x=pos.x, y=pos.y+1, z=pos.z}
  222. local north = {x=pos.x, y=pos.y+1, z=pos.z+1}
  223. local north2 = {x=pos.x, y=pos.y+1, z=pos.z+2}
  224. local south = {x=pos.x, y=pos.y+1, z=pos.z-1}
  225. local south2 = {x=pos.x, y=pos.y+1, z=pos.z-2}
  226. local west = {x=pos.x-1, y=pos.y+1, z=pos.z}
  227. local west2 = {x=pos.x-2, y=pos.y+1, z=pos.z}
  228. local east = {x=pos.x+1, y=pos.y+1, z=pos.z}
  229. local east2 = {x=pos.x+2, y=pos.y+1, z=pos.z}
  230. local node_here = minetest.get_node(right_here)
  231. local node_north = minetest.get_node(north)
  232. local node_north2 = minetest.get_node(north2)
  233. local node_south = minetest.get_node(south)
  234. local node_south2 = minetest.get_node(south2)
  235. local node_west = minetest.get_node(west)
  236. local node_west2 = minetest.get_node(west2)
  237. local node_east = minetest.get_node(east)
  238. local node_east2 = minetest.get_node(east2)
  239. if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true,
  240. for i in pairs(TRuNKS) do
  241. local MoD = TRuNKS[i][1]
  242. local TRuNK = TRuNKS[i][2]
  243. local NR = TRuNKS[i][3]
  244. local chance = math.random(1, 17)
  245. local length = math.random(3,5)
  246. if chance == NR then
  247. local trunk_type = math.random(1,3)
  248. if trunk_type == 1 then
  249. if minetest.get_modpath(MoD) ~= nil then
  250. minetest.set_node(right_here, {name=MoD..":"..TRuNK})
  251. else
  252. minetest.set_node(right_here, {name="default:tree"})
  253. end
  254. elseif trunk_type == 2 and Horizontal_Trunks == true then
  255. if minetest.get_modpath(MoD) ~= nil then
  256. if minetest.registered_nodes[node_north.name].buildable_to then
  257. minetest.set_node(north, {name=MoD..":"..TRuNK, param2=4})
  258. end
  259. if length >= 4 and minetest.registered_nodes[node_north2.name].buildable_to then
  260. minetest.set_node(north2, {name=MoD..":"..TRuNK, param2=4})
  261. end
  262. minetest.set_node(right_here, {name=MoD..":"..TRuNK, param2=4})
  263. if minetest.registered_nodes[node_south.name].buildable_to then
  264. minetest.set_node(south, {name=MoD..":"..TRuNK, param2=4})
  265. end
  266. if length == 5 and minetest.registered_nodes[node_south2.name].buildable_to then
  267. minetest.set_node(south2, {name=MoD..":"..TRuNK, param2=4})
  268. end
  269. else
  270. if minetest.registered_nodes[node_north.name].buildable_to then
  271. minetest.set_node(north, {name="default:tree", param2=4})
  272. end
  273. if length >= 4 and minetest.registered_nodes[node_north2.name].buildable_to then
  274. minetest.set_node(north2, {name="default:tree", param2=4})
  275. end
  276. minetest.set_node(right_here, {name="default:tree", param2=4})
  277. if minetest.registered_nodes[node_south.name].buildable_to then
  278. minetest.set_node(south, {name="default:tree", param2=4})
  279. end
  280. if length == 5 and minetest.registered_nodes[node_south2.name].buildable_to then
  281. minetest.set_node(south2, {name="default:tree", param2=4})
  282. end
  283. end
  284. elseif trunk_type == 3 and Horizontal_Trunks == true then
  285. if minetest.get_modpath(MoD) ~= nil then
  286. if minetest.registered_nodes[node_west.name].buildable_to then
  287. minetest.set_node(west, {name=MoD..":"..TRuNK, param2=12})
  288. end
  289. if length >= 4 and minetest.registered_nodes[node_west2.name].buildable_to then
  290. minetest.set_node(west2, {name=MoD..":"..TRuNK, param2=12})
  291. end
  292. minetest.set_node(right_here, {name=MoD..":"..TRuNK, param2=12})
  293. if minetest.registered_nodes[node_east.name].buildable_to then
  294. minetest.set_node(east, {name=MoD..":"..TRuNK, param2=12})
  295. end
  296. if length == 5 and minetest.registered_nodes[node_east2.name].buildable_to then
  297. minetest.set_node(east2, {name=MoD..":"..TRuNK, param2=12})
  298. end
  299. else
  300. if minetest.registered_nodes[node_west.name].buildable_to then
  301. minetest.set_node(west, {name="default:tree", param2=12})
  302. end
  303. if length >= 4 and minetest.registered_nodes[node_west2.name].buildable_to then
  304. minetest.set_node(west2, {name="default:tree", param2=12})
  305. end
  306. minetest.set_node(right_here, {name="default:tree", param2=12})
  307. if minetest.registered_nodes[node_east.name].buildable_to then
  308. minetest.set_node(east, {name="default:tree", param2=12})
  309. end
  310. if length == 5 and minetest.registered_nodes[node_east2.name].buildable_to then
  311. minetest.set_node(east2, {name="default:tree", param2=12})
  312. end
  313. end
  314. end
  315. end
  316. end
  317. end
  318. end
  319. biome_lib:register_generate_plant({
  320. surface = {"default:dirt_with_grass"},
  321. max_count = Trunks_Max_Count, -- 320,
  322. rarity = Trunks_Rarity, -- 99,
  323. min_elevation = 1,
  324. max_elevation = 40,
  325. avoid_nodes = {"group:tree"},
  326. avoid_radius = 1,
  327. near_nodes = {"group:tree","ferns:fern_03","ferns:fern_02","ferns:fern_01"},
  328. near_nodes_size = 3,
  329. near_nodes_vertical = 1,
  330. near_nodes_count = 1,
  331. plantlife_limit = -0.9,
  332. },
  333. abstract_trunks.place_trunk
  334. )
  335. -----------------------------------------------------------------------------------------------
  336. -- MoSS & FuNGuS -- on ground
  337. -----------------------------------------------------------------------------------------------
  338. if Moss_on_ground == true then
  339. abstract_trunks.grow_moss_on_ground = function(pos)
  340. local on_ground = {x=pos.x, y=pos.y+1, z=pos.z}
  341. local moss_type = math.random(1,21)
  342. if moss_type == 1 then
  343. minetest.set_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3)})
  344. else
  345. minetest.set_node(on_ground, {name="trunks:moss", param2=math.random(0,3)})
  346. end
  347. end
  348. biome_lib:register_generate_plant({
  349. surface = {"default:dirt_with_grass"},
  350. max_count = Moss_on_ground_Max_Count,
  351. rarity = Moss_on_ground_Rarity,
  352. min_elevation = 1,
  353. max_elevation = 40,
  354. near_nodes = {
  355. "group:tree",
  356. "ferns:fern_03",
  357. "ferns:fern_02",
  358. "ferns:fern_01"
  359. },
  360. near_nodes_size = 2,
  361. near_nodes_vertical = 1,
  362. near_nodes_count = 1,
  363. plantlife_limit = -0.9,
  364. },
  365. abstract_trunks.grow_moss_on_ground
  366. )
  367. end
  368. -----------------------------------------------------------------------------------------------
  369. -- MoSS & FuNGuS -- on trunks
  370. -----------------------------------------------------------------------------------------------
  371. if Moss_on_trunk == true then
  372. abstract_trunks.grow_moss_on_trunk = function(pos)
  373. local on_ground = {x=pos.x, y=pos.y+1, z=pos.z}
  374. local at_side_n = {x=pos.x, y=pos.y, z=pos.z+1}
  375. local at_side_e = {x=pos.x+1, y=pos.y, z=pos.z}
  376. local at_side_s = {x=pos.x, y=pos.y, z=pos.z-1}
  377. local at_side_w = {x=pos.x-1, y=pos.y, z=pos.z}
  378. local undrneath = {x=pos.x, y=pos.y-1, z=pos.z}
  379. local node_here = minetest.get_node(on_ground)
  380. local node_north = minetest.get_node(at_side_n)
  381. local node_east = minetest.get_node(at_side_e)
  382. local node_south = minetest.get_node(at_side_s)
  383. local node_west = minetest.get_node(at_side_w)
  384. local node_under = minetest.get_node(undrneath)
  385. --if minetest.get_item_group(node_under.name, "tree") < 1 then
  386. local moss_type = math.random(1,41)
  387. if minetest.registered_nodes[node_here.name].buildable_to then -- instead of check_air = true,
  388. if moss_type == 1 then
  389. minetest.set_node(on_ground, {name="trunks:moss_fungus", param2=math.random(0,3) --[[1]]})
  390. elseif moss_type < 22 then
  391. minetest.set_node(on_ground, {name="trunks:moss", param2=math.random(0,3) --[[1]]})
  392. end
  393. end
  394. local moss_type = math.random(1,31) -- cliche of more moss at north
  395. if minetest.registered_nodes[node_north.name].buildable_to then -- instead of check_air = true,
  396. if moss_type == 1 then
  397. minetest.set_node(at_side_n, {name="trunks:moss_fungus", param2=math.random(4,7)}) -- 5,4,6,7
  398. elseif moss_type < 22 then
  399. minetest.set_node(at_side_n, {name="trunks:moss", param2=math.random(4,7)})
  400. end
  401. end
  402. local moss_type = math.random(1,41)
  403. if minetest.registered_nodes[node_east.name].buildable_to then -- instead of check_air = true,
  404. if moss_type == 1 then
  405. minetest.set_node(at_side_e, {name="trunks:moss_fungus", param2=math.random(12,15)})
  406. elseif moss_type < 22 then
  407. minetest.set_node(at_side_e, {name="trunks:moss", param2=math.random(12,15)})
  408. end
  409. end
  410. local moss_type = math.random(1,41)
  411. if minetest.registered_nodes[node_south.name].buildable_to then -- instead of check_air = true,
  412. if moss_type == 1 then
  413. minetest.set_node(at_side_s, {name="trunks:moss_fungus", param2=math.random(8,11)})
  414. elseif moss_type < 22 then
  415. minetest.set_node(at_side_s, {name="trunks:moss", param2=math.random(8,11)})
  416. end
  417. end
  418. local moss_type = math.random(1,41)
  419. if minetest.registered_nodes[node_west.name].buildable_to then -- instead of check_air = true,
  420. if moss_type == 1 then
  421. minetest.set_node(at_side_w, {name="trunks:moss_fungus", param2=math.random(16,19)})
  422. elseif moss_type < 22 then
  423. minetest.set_node(at_side_w, {name="trunks:moss", param2=math.random(16,19)})
  424. end
  425. end
  426. --end
  427. end
  428. biome_lib:register_generate_plant({
  429. surface = {
  430. "default:tree",
  431. "default:jungletree",
  432. "trees:tree_conifer",
  433. "trees:tree_mangrove",
  434. --"trees:tree_palm",
  435. "moretrees:apple_tree_trunk",
  436. "moretrees:beech_trunk",
  437. "moretrees:birch_trunk",
  438. "moretrees:fir_trunk",
  439. "moretrees:oak_trunk",
  440. --"moretrees:palm_trunk",
  441. "moretrees:pine_trunk",
  442. "moretrees:rubber_tree_trunk",
  443. "moretrees:rubber_tree_trunk_empty",
  444. "moretrees:sequoia_trunk",
  445. "moretrees:spruce_trunk",
  446. "moretrees:willow_trunk",
  447. "default:mossycobble"
  448. },
  449. max_count = Moss_on_trunk_Max_Count,
  450. rarity = Moss_on_trunk_Rarity,
  451. min_elevation = 1,
  452. max_elevation = 40,
  453. plantlife_limit = -0.9,
  454. check_air = false,
  455. },
  456. "abstract_trunks.grow_moss_on_trunk"
  457. )
  458. end
  459. -----------------------------------------------------------------------------------------------
  460. -- RooTS
  461. -----------------------------------------------------------------------------------------------
  462. if Roots == true then -- see settings.txt
  463. abstract_trunks.grow_roots = function(pos)
  464. local twig_size = math.random(1,27)
  465. local right_here = {x=pos.x , y=pos.y , z=pos.z }
  466. local below = {x=pos.x , y=pos.y-1, z=pos.z }
  467. local north = {x=pos.x , y=pos.y , z=pos.z+1}
  468. local east = {x=pos.x+1, y=pos.y , z=pos.z }
  469. local south = {x=pos.x , y=pos.y , z=pos.z-1}
  470. local west = {x=pos.x-1, y=pos.y , z=pos.z }
  471. local node_here = minetest.get_node(right_here)
  472. local node_below = minetest.get_node(below)
  473. local node_north = minetest.get_node(north)
  474. local node_east = minetest.get_node(east)
  475. local node_south = minetest.get_node(south)
  476. local node_west = minetest.get_node(west)
  477. for i in pairs(TRuNKS) do
  478. local MoD = TRuNKS[i][1]
  479. local TRuNK = TRuNKS[i][2]
  480. if minetest.get_modpath(MoD) ~= nil
  481. and node_here.name == MoD..":"..TRuNK
  482. and string.find(node_below.name, "dirt")
  483. and node_here.param2 == 0 then
  484. if minetest.registered_nodes[node_north.name].buildable_to then
  485. minetest.set_node(north, {name="trunks:"..TRuNK.."root", param2=2})
  486. end
  487. if minetest.registered_nodes[node_east.name].buildable_to then
  488. minetest.set_node(east, {name="trunks:"..TRuNK.."root", param2=3})
  489. end
  490. if minetest.registered_nodes[node_south.name].buildable_to then
  491. minetest.set_node(south, {name="trunks:"..TRuNK.."root", param2=0})
  492. end
  493. if minetest.registered_nodes[node_west.name].buildable_to then
  494. minetest.set_node(west, {name="trunks:"..TRuNK.."root", param2=1})
  495. end
  496. end
  497. end
  498. end
  499. biome_lib:register_generate_plant({
  500. surface = {"group:tree"},
  501. max_count = 1000,
  502. rarity = 1,
  503. min_elevation = 1,
  504. max_elevation = 40,
  505. near_nodes = {"default:dirt_with_grass"},
  506. near_nodes_size = 1,
  507. near_nodes_vertical = 1,
  508. near_nodes_count = 1,
  509. plantlife_limit = -1,
  510. check_air = false,
  511. },
  512. "abstract_trunks.grow_roots"
  513. )
  514. end