trees.lua 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  1. --[[
  2. treecapitator.register_tree({
  3. trees = {<node1>, <node2>, ...},
  4. leaves = {<node1>, <node2>, ...},
  5. range = <range>,
  6. range_up = <range>,
  7. range_down = <range>,
  8. fruits = {<node1>, <node2>, ...},
  9. trunk_fruit_vertical = <some_boolean>,
  10. cutting_leaves = <leaves_count>,
  11. stem_type = <some_string>,
  12. stem_height_min = <height>,
  13. requisite_leaves = {<node1>, <node2>, ...},
  14. type = "default",
  15. })
  16. trees
  17. the straight stem nodes with param2=0
  18. leaves
  19. nodes of the tree head which only drop their main item if drop_leaf is enabled
  20. range
  21. the size of the tree head cuboid
  22. when using thicker stems the range needs to be bigger
  23. range_up
  24. range upwards beginning from the highest trunk node to head top
  25. if omitted it's set to range
  26. range_down
  27. like range_up but downwards
  28. fruits
  29. similar to leaves but without the drop_leaf setting condition
  30. trunk_fruit_vertical
  31. set this to true to make a trunk node, if it's in trees
  32. and fruits, get removed even if it isn't rotated (param2 = 0)
  33. cutting_leaves
  34. used as workaround for moretrees#34
  35. stem_type
  36. set to "2x2" for a thick tree, "+" for a even thicker one,
  37. anything else is currently interpreted as single stem
  38. stem_height_min
  39. indicates how much trunk nodes a neighbour tree stem has to
  40. consist of
  41. requisite_leaves
  42. if set, abort capitating if one of those nodes weren't found in the head
  43. treecapitator.register_tree({
  44. trees = {<node1>, <node2>, ...},
  45. leaves = {<node1>, <node2>, ...},
  46. range = <range>,
  47. fruits = {<node1>, <node2>, ...},
  48. height = <height>,
  49. max_nodes = <max_nodes>,
  50. num_trunks_min = <some_number>,
  51. num_trunks_max = <some_number>,
  52. num_leaves_min = <some_number>,
  53. num_leaves_max = <some_number>,
  54. type = "moretrees",
  55. })
  56. height: maximum tree height
  57. max_nodes: maximum amount of nodes the tree is allowed to consist of
  58. num_trunks_min…
  59. ]]
  60. -- Please try to match the tree definition close to the real tree for a more
  61. -- fitting usage of neighbour detection and similar mechanisms.
  62. local mgname = minetest.get_mapgen_setting"mg_name"
  63. if mgname == "v7" then
  64. treecapitator.register_tree{
  65. trees = {"default:tree"},
  66. leaves = {"default:leaves"},
  67. range = 2,
  68. range_up = 4,
  69. range_down = 0,
  70. fruits = {"default:apple", "default:tree"},
  71. trunk_fruit_vertical = true
  72. }
  73. elseif mgname == "valleys" then
  74. treecapitator.register_tree({
  75. trees = {"default:tree"},
  76. leaves = {"default:leaves"},
  77. range = 2,
  78. range_up = 5,
  79. range_down = 0,
  80. fruits = {"default:apple", "default:tree"},
  81. trunk_fruit_vertical = true,
  82. })
  83. else
  84. treecapitator.register_tree{
  85. trees = {"default:tree"},
  86. leaves = {"default:leaves"},
  87. range = 2,
  88. fruits = {"default:apple"}
  89. }
  90. end
  91. if mgname == "valleys" then
  92. treecapitator.register_tree({
  93. trees = {"default:jungletree"},
  94. leaves = {"default:jungleleaves"},
  95. fruits = {"default:jungletree"},
  96. range = 4,
  97. range_up = 14,
  98. range_down = 3,
  99. trunk_fruit_vertical = true,
  100. cutting_leaves = 5,
  101. stem_height_min = 12,
  102. })
  103. treecapitator.register_tree({
  104. trees = {"default:jungletree"},
  105. leaves = {"default:jungleleaves"},
  106. fruits = {"default:jungletree"},
  107. range = 4,
  108. range_up = 14,
  109. range_down = 3,
  110. trunk_fruit_vertical = true,
  111. cutting_leaves = 5,
  112. stem_type = "2x2",
  113. stem_height_min = 12,
  114. })
  115. else
  116. treecapitator.register_tree({
  117. trees = {"default:jungletree"},
  118. leaves = {"default:jungleleaves"},
  119. range = 3
  120. })
  121. end
  122. treecapitator.register_tree({
  123. trees = {"default:pine_tree"},
  124. leaves = {"default:pine_needles"},
  125. range_up = 2,
  126. range_down = 6,
  127. range = 3,
  128. })
  129. treecapitator.register_tree({
  130. trees = {"default:acacia_tree"},
  131. leaf = "default:acacia_leaves",
  132. no_param2test = true,
  133. --leavesrange = 4,
  134. type = "acacia"
  135. })
  136. treecapitator.register_tree({
  137. trees = {"default:aspen_tree"},
  138. leaves = {"default:aspen_leaves"},
  139. range = 4,
  140. })
  141. if minetest.get_modpath("farming_plus") then
  142. treecapitator.register_tree({
  143. trees = {"default:tree"},
  144. leaves = {"farming_plus:banana_leaves"},
  145. range = 2,
  146. fruits = {"farming_plus:banana"}
  147. })
  148. treecapitator.register_tree({
  149. trees = {"default:tree"},
  150. leaves = {"farming_plus:cocoa_leaves"},
  151. range = 2,
  152. fruits = {"farming_plus:cocoa"}
  153. })
  154. end
  155. if treecapitator.moretrees_support
  156. and minetest.get_modpath("moretrees") then
  157. treecapitator.register_tree({
  158. trees = {"moretrees:acacia_trunk"},
  159. leaves = {"moretrees:acacia_leaves"},
  160. range = 10,
  161. })
  162. treecapitator.register_tree{
  163. trees = {"moretrees:poplar_trunk"},
  164. leaves = {"moretrees:poplar_leaves"},
  165. range_up = 5,
  166. range_down = 17,
  167. range = 2,
  168. }
  169. local dates = {"moretrees:dates_fn", "moretrees:dates_m0",
  170. "moretrees:dates_n"}
  171. for i = 0, 4 do
  172. dates[#dates+1] = "moretrees:dates_f" .. i
  173. end
  174. dates[#dates+1] = "moretrees:date_palm_trunk"
  175. treecapitator.register_tree{
  176. trees = {
  177. "moretrees:date_palm_trunk",
  178. "moretrees:date_palm_mfruit_trunk",
  179. "moretrees:date_palm_ffruit_trunk"
  180. },
  181. leaves = {"moretrees:date_palm_leaves"},
  182. fruits = dates,
  183. trunk_fruit_vertical = true,
  184. range = 11,
  185. range_up = 15,
  186. range_down = 0,
  187. }
  188. treecapitator.register_tree{
  189. trees = {"moretrees:apple_tree_trunk"},
  190. leaves = {"moretrees:apple_tree_leaves"},
  191. fruits = {"default:apple", "moretrees:apple_tree_trunk"},
  192. trunk_fruit_vertical = true,
  193. range = 9,
  194. range_up = 3,
  195. range_down = 4,
  196. }
  197. treecapitator.register_tree{
  198. trees = {"moretrees:beech_trunk"},
  199. leaves = {"moretrees:beech_leaves"},
  200. range = 4,
  201. range_down = 2,
  202. range_up = 3,
  203. fruits = {"moretrees:beech_trunk"},
  204. trunk_fruit_vertical = true
  205. }
  206. treecapitator.register_tree{
  207. trees = {"moretrees:birch_trunk"},
  208. leaves = {"moretrees:birch_leaves"},
  209. fruits = {"moretrees:birch_trunk"},
  210. trunk_fruit_vertical = true,
  211. cutting_leaves = 3,
  212. stem_height_min = 4,
  213. range = 8,
  214. range_down = 13,
  215. range_up = 10,
  216. }
  217. treecapitator.register_tree{
  218. trees = {"moretrees:fir_trunk"},
  219. leaves = {"moretrees:fir_leaves", "moretrees:fir_leaves_bright"},
  220. range_up = 2,
  221. range_down = 21,
  222. range = 7,
  223. fruits = {"moretrees:fir_cone", "moretrees:fir_trunk"},
  224. trunk_fruit_vertical = true
  225. }
  226. treecapitator.register_tree({
  227. trees = {"moretrees:jungletree_trunk"},
  228. leaves = {"moretrees:jungletree_leaves_green",
  229. "jungletree_leaves_yellow", "jungletree_leaves_red"},
  230. range = 8,
  231. })
  232. treecapitator.register_tree{
  233. trees = {"moretrees:oak_trunk"},
  234. leaves = {"moretrees:oak_leaves"},
  235. fruits = {"moretrees:acorn", "moretrees:oak_trunk"},
  236. trunk_fruit_vertical = true,
  237. stem_type = "+",
  238. range = 11,
  239. range_up = 11,
  240. range_down = 1,
  241. }
  242. -- needs special type
  243. treecapitator.register_tree({
  244. trees = {"moretrees:cedar_trunk"},
  245. leaves = {"moretrees:cedar_leaves"},
  246. range = 10,
  247. range_up = 1,
  248. range_down = 19,
  249. trunk_fruit_vertical = true,
  250. fruits = {"moretrees:cedar_cone", "moretrees:cedar_trunk"}
  251. })
  252. treecapitator.register_tree{
  253. trees = {"moretrees:rubber_tree_trunk",
  254. "moretrees:rubber_tree_trunk_empty"},
  255. leaves = {"moretrees:rubber_tree_leaves"},
  256. fruits = {"moretrees:rubber_tree_trunk",
  257. "moretrees:rubber_tree_trunk_empty"},
  258. trunk_fruit_vertical = true,
  259. stem_type = "2x2",
  260. range = 8,
  261. range_down = 1,
  262. range_up = 8,
  263. }
  264. treecapitator.register_tree{
  265. trees = {"moretrees:sequoia_trunk"},
  266. leaves = {"moretrees:sequoia_leaves"},
  267. fruits = {"moretrees:sequoia_trunk"},
  268. trunk_fruit_vertical = true,
  269. stem_type = "+",
  270. range = 10,
  271. range_up = 3,
  272. range_down = 33,
  273. cutting_leaves = 6,
  274. stem_height_min = 6,
  275. }
  276. treecapitator.register_tree{
  277. trees = {"moretrees:spruce_trunk"},
  278. leaves = {"moretrees:spruce_leaves"},
  279. fruits = {"moretrees:spruce_cone", "moretrees:spruce_trunk"},
  280. trunk_fruit_vertical = true,
  281. cutting_leaves = 1,
  282. stem_type = "+",
  283. range = 10,
  284. range_down = 25,
  285. range_up = 5,
  286. }
  287. treecapitator.register_tree{
  288. trees = {"moretrees:willow_trunk"},
  289. leaves = {"moretrees:willow_leaves"},
  290. fruits = {"moretrees:willow_trunk"},
  291. trunk_fruit_vertical = true,
  292. stem_type = "+",
  293. range = 13,
  294. range_up = 6,
  295. range_down = 6,
  296. }
  297. treecapitator.register_tree{ -- small and 2x2 jungletree at once
  298. trees = {"moretrees:jungletree_trunk"},
  299. leaves = {"default:jungleleaves", "moretrees:jungletree_leaves_red"},
  300. fruits = {"moretrees:jungletree_trunk"},
  301. requisite_leaves = {"moretrees:jungletree_leaves_red"},
  302. trunk_fruit_vertical = true,
  303. stem_height_min = 4,
  304. cutting_leaves = 5,
  305. stem_type = "2x2",
  306. range = 8, -- 5 small
  307. range_up = 2, -- 1 small
  308. range_down = 17, -- 6 small
  309. }
  310. treecapitator.register_tree{
  311. trees = {"moretrees:jungletree_trunk"},
  312. leaves = {"default:jungleleaves", "moretrees:jungletree_leaves_yellow",
  313. "moretrees:jungletree_leaves_red"},
  314. fruits = {"moretrees:jungletree_trunk"},
  315. requisite_leaves = {"moretrees:jungletree_leaves_yellow"},
  316. trunk_fruit_vertical = true,
  317. cutting_leaves = 5,
  318. stem_type = "+",
  319. range = 8,
  320. range_up = 4,
  321. range_down = 16,
  322. }
  323. treecapitator.register_tree{
  324. trees = {"moretrees:palm_trunk"},
  325. trunk_top = "moretrees:palm_fruit_trunk",
  326. leaves = "moretrees:palm_leaves",
  327. fruit = "moretrees:coconut",
  328. range = 10,
  329. range_up = 7,
  330. range_down = 4,
  331. max_forbi = 2,
  332. type = "palm",
  333. }
  334. --~ treecapitator.register_tree({
  335. --~ trees = {"moretrees:sequoia_trunk"},
  336. --~ leaves = {"moretrees:sequoia_leaves"},
  337. --~ range = 8,
  338. --~ height = 17,
  339. --~ max_nodes = 8000,
  340. --~ num_trunks_min = 5,
  341. --~ num_trunks_max = 400,
  342. --~ num_leaves_min = 10,
  343. --~ num_leaves_max = 4000,
  344. --~ type = "moretrees",
  345. --~ })
  346. --~ treecapitator.register_tree({
  347. --~ trees = {"moretrees:willow_trunk"},
  348. --~ leaves = {"moretrees:willow_leaves"},
  349. --~ range = 11,
  350. --~ height = 17,
  351. --~ max_nodes = 8000,
  352. --~ num_trunks_min = 5,
  353. --~ num_trunks_max = 400,
  354. --~ num_leaves_min = 10,
  355. --~ num_leaves_max = 4000,
  356. --~ type = "moretrees",
  357. --~ })
  358. end
  359. -- code from amadin and narrnika
  360. if minetest.get_modpath("ethereal") then
  361. treecapitator.register_tree({--jungle [эвкалипт]
  362. trees = {"default:jungletree"},
  363. leaves = {"default:jungleleaves"},
  364. range = 3,
  365. height = 20,
  366. max_nodes = 145,
  367. num_trunks_min = 0,
  368. num_trunks_max = 35,
  369. num_leaves_min = 0,
  370. num_leaves_max = 110,
  371. type = "moretrees",
  372. })
  373. treecapitator.register_tree({--pine [кедр]
  374. trees = {"default:pinetree"}, -- this may need to be changed to pine_tree
  375. leaves = {"ethereal:pineleaves"},
  376. range = 6,
  377. type = "default",
  378. })
  379. treecapitator.register_tree({--orange [апельсиновое дерево]
  380. trees = {"default:tree"},
  381. leaves = {"default:leaves", "ethereal:orange_leaves"},
  382. fruits = {"default:apple", "ethereal:orange"},
  383. range = 2,
  384. type = "default",
  385. })
  386. treecapitator.register_tree({--acacia [акация]
  387. trees = {"ethereal:acacia_trunk"},
  388. leaves = {"ethereal:acacia_leaves"},
  389. range = 10,
  390. height = 10,
  391. max_nodes = 122,
  392. num_trunks_min = 0,
  393. num_trunks_max = 22,
  394. num_leaves_min = 0,
  395. num_leaves_max = 100,
  396. type = "moretrees",
  397. })
  398. treecapitator.register_tree({--banana [банановое дерево]
  399. trees = {"ethereal:banana_trunk"},
  400. leaves = {"ethereal:bananaleaves"},
  401. fruits = {"ethereal:banana"},
  402. range = 3,
  403. height = 7,
  404. max_nodes = 28,
  405. num_trunks_min = 0,
  406. num_trunks_max = 4,
  407. num_leaves_min = 0,
  408. num_leaves_max = 20,
  409. type = "moretrees",
  410. })
  411. treecapitator.register_tree({--coconut [кокосовое дерево]
  412. trees = {"ethereal:palm_trunk"},
  413. leaves = {"ethereal:palmleaves"},
  414. fruits = {"ethereal:coconut"},
  415. range = 3,
  416. height = 9,
  417. max_nodes = 37,
  418. num_trunks_min = 0,
  419. num_trunks_max = 8,
  420. num_leaves_min = 0,
  421. num_leaves_max = 25,
  422. type = "moretrees",
  423. })
  424. treecapitator.register_tree({--willow [ива]
  425. trees = {"ethereal:willow_trunk"},
  426. leaves = {"ethereal:willow_twig"},
  427. range = 10,
  428. height = 13,
  429. max_nodes = 540,
  430. num_trunks_min = 0,
  431. num_trunks_max = 90,
  432. num_leaves_min = 0,
  433. num_leaves_max = 450,
  434. type = "moretrees",
  435. })
  436. treecapitator.register_tree({--moshroom [гриб]
  437. trees = {"ethereal:mushroom_trunk"},
  438. leaves = {"ethereal:mushroom", "ethereal:mushroom_porew"},
  439. range = 4,
  440. height = 10,
  441. max_nodes = 100,
  442. num_trunks_min = 0,
  443. num_trunks_max = 32,
  444. num_leaves_min = 0,
  445. num_leaves_max = 80,
  446. type = "moretrees",
  447. })
  448. end