schems.lua 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. local path = minetest.get_modpath("ethereal") .. "/schematics/"
  2. local dpath = minetest.get_modpath("default") .. "/schematics/"
  3. -- load schematic tables
  4. dofile(path .. "orange_tree.lua")
  5. dofile(path .. "banana_tree.lua")
  6. dofile(path .. "bamboo_tree.lua")
  7. dofile(path .. "birch_tree.lua")
  8. dofile(path .. "bush.lua")
  9. dofile(path .. "waterlily.lua")
  10. dofile(path .. "volcanom.lua")
  11. dofile(path .. "volcanol.lua")
  12. dofile(path .. "frosttrees.lua")
  13. dofile(path .. "palmtree.lua")
  14. dofile(path .. "pinetree.lua")
  15. dofile(path .. "yellowtree.lua")
  16. dofile(path .. "mushroomone.lua")
  17. dofile(path .. "willow.lua")
  18. dofile(path .. "bigtree.lua")
  19. dofile(path .. "redwood_tree.lua")
  20. dofile(path .. "redwood_small_tree.lua")
  21. dofile(path .. "vinetree.lua")
  22. dofile(path .. "sakura.lua")
  23. dofile(path .. "igloo.lua")
  24. dofile(path .. "lemon_tree.lua")
  25. dofile(path .. "olive_tree.lua")
  26. -- helper function
  27. local add_schem = function(a, b, c, d, e, f, g, h, i, j, k)
  28. -- if not 1 then biome disabled, don't add
  29. if g ~= 1 then return end
  30. minetest.register_decoration({
  31. deco_type = "schematic",
  32. place_on = a,
  33. sidelen = 80,
  34. fill_ratio = b,
  35. biomes = c,
  36. y_min = d,
  37. y_max = e,
  38. schematic = f,
  39. flags = "place_center_x, place_center_z",
  40. replacements = h,
  41. spawn_by = i,
  42. num_spawn_by = j,
  43. rotation = k
  44. })
  45. end
  46. -- igloo
  47. add_schem("default:snowblock", 0.0005, {"glacier"}, 3, 50,
  48. ethereal.igloo, ethereal.glacier, nil, "default:snowblock", 8, "random")
  49. -- sakura tree
  50. add_schem({"ethereal:bamboo_dirt"}, 0.001, {"sakura"}, 7, 100,
  51. ethereal.sakura_tree, ethereal.sakura, nil,
  52. "ethereal:bamboo_dirt", 6)
  53. -- redwood tree
  54. add_schem({"default:dirt_with_dry_grass"}, 0.0025, {"mesa"}, 1, 100,
  55. ethereal.redwood_tree, ethereal.mesa, nil,
  56. "default:dirt_with_dry_grass", 8)
  57. -- banana tree
  58. add_schem({"ethereal:grove_dirt"}, 0.015, {"grove"}, 1, 100,
  59. ethereal.bananatree, ethereal.grove)
  60. -- healing tree
  61. add_schem({"default:dirt_with_snow"}, 0.01, {"taiga"}, 120, 140,
  62. ethereal.yellowtree, ethereal.alpine, nil, "default:dirt_with_snow", 8)
  63. -- crystal frost tree
  64. add_schem({"ethereal:crystal_dirt"}, 0.01, {"frost", "frost_floatland"}, 1, 1750,
  65. ethereal.frosttrees, ethereal.frost, nil,
  66. "ethereal:crystal_dirt", 8)
  67. -- giant mushroom
  68. add_schem("ethereal:mushroom_dirt", 0.02, {"mushroom"}, 1, 100,
  69. ethereal.mushroomone, ethereal.mushroom, nil,
  70. "ethereal:mushroom_dirt", 8)
  71. -- small lava crater
  72. add_schem("ethereal:fiery_dirt", 0.01, {"fiery"}, 1, 100,
  73. ethereal.volcanom, ethereal.fiery, nil, "ethereal:fiery_dirt", 8)
  74. -- large lava crater
  75. add_schem("ethereal:fiery_dirt", 0.003, {"fiery"}, 1, 100,
  76. ethereal.volcanol, ethereal.fiery, nil, "ethereal:fiery_dirt", 8, "random")
  77. -- default jungle tree
  78. add_schem({"ethereal:jungle_dirt", "default:dirt_with_rainforest_litter"},
  79. 0.08, {"junglee"}, 1, 100, dpath .. "jungle_tree.mts", ethereal.junglee)
  80. -- willow tree
  81. add_schem({"ethereal:gray_dirt"}, 0.02, {"grayness"}, 1, 100,
  82. ethereal.willow, ethereal.grayness, nil,
  83. "ethereal:gray_dirt", 6)
  84. -- default large pine tree for lower elevation
  85. add_schem({"ethereal:cold_dirt", "default:dirt_with_coniferous_litter"},
  86. 0.025, {"coniferous_forest"}, 10, 40, ethereal.pinetree, ethereal.snowy)
  87. -- small pine for higher elevation
  88. add_schem({"default:dirt_with_snow"}, 0.025, {"taiga"}, 40, 140,
  89. ethereal.pinetree, ethereal.alpine)
  90. -- default apple tree
  91. add_schem({"default:dirt_with_grass"}, 0.025, {"jumble", "deciduous_forest"}, 1, 100,
  92. dpath .. "apple_tree.mts", ethereal.grassy)
  93. -- big old tree
  94. add_schem({"default:dirt_with_grass"}, 0.001, {"jumble"}, 1, 100,
  95. ethereal.bigtree, ethereal.jumble, nil,
  96. "default:dirt_with_grass", 8)
  97. -- default aspen tree
  98. add_schem({"default:dirt_with_grass"}, 0.02, {"grassytwo"}, 1, 50,
  99. dpath .. "aspen_tree.mts", ethereal.jumble)
  100. -- birch tree
  101. add_schem({"default:dirt_with_grass"}, 0.02, {"grassytwo"}, 50, 100,
  102. ethereal.birchtree, ethereal.grassytwo)
  103. -- orange tree
  104. add_schem({"ethereal:prairie_dirt"}, 0.01, {"prairie"}, 1, 100,
  105. ethereal.orangetree, ethereal.prairie)
  106. -- default acacia tree
  107. add_schem({"default:dry_dirt_with_dry_grass",
  108. "default:dirt_with_dry_grass"}, 0.004, {"savanna"}, 1, 100,
  109. dpath .. "acacia_tree.mts", ethereal.savanna)
  110. -- palm tree
  111. add_schem("default:sand", 0.0025, {"desert_ocean", "plains_ocean", "sandclay",
  112. "sandstone_ocean", "mesa_ocean", "grove_ocean", "deciduous_forest_ocean"}, 1, 1,
  113. ethereal.palmtree, 1)
  114. -- bamboo tree
  115. add_schem({"ethereal:bamboo_dirt"}, 0.025, {"bamboo"}, 1, 100,
  116. ethereal.bambootree, ethereal.bamboo)
  117. -- bush
  118. add_schem({"ethereal:bamboo_dirt"}, 0.08, {"bamboo"}, 1, 100, ethereal.bush,
  119. ethereal.bamboo)
  120. -- vine tree
  121. add_schem({"default:dirt_with_grass"}, 0.02, {"swamp"}, 1, 100,
  122. ethereal.vinetree, ethereal.swamp)
  123. -- lemon tree
  124. add_schem({"ethereal:grove_dirt"}, 0.002, {"mediterranean"}, 5, 50,
  125. ethereal.lemontree, ethereal.mediterranean)
  126. -- olive tree
  127. add_schem({"ethereal:grove_dirt"}, 0.002, {"mediterranean"}, 5, 35,
  128. ethereal.olivetree, ethereal.mediterranean)
  129. -- default large cactus
  130. if ethereal.desert == 1 then
  131. minetest.register_decoration({
  132. deco_type = "schematic",
  133. place_on = {"default:desert_sand"},
  134. sidelen = 80,
  135. noise_params = {
  136. offset = -0.0005,
  137. scale = 0.0015,
  138. spread = {x = 200, y = 200, z = 200},
  139. seed = 230,
  140. octaves = 3,
  141. persist = 0.6
  142. },
  143. biomes = {"desert"},
  144. y_min = 5,
  145. y_max = 31000,
  146. schematic = dpath .. "large_cactus.mts",
  147. flags = "place_center_x",
  148. rotation = "random",
  149. })
  150. end
  151. -- default bush
  152. minetest.register_decoration({
  153. deco_type = "schematic",
  154. place_on = {"default:dirt_with_grass", "default:dirt_with_snow"},
  155. sidelen = 16,
  156. noise_params = {
  157. offset = -0.004,
  158. scale = 0.01,
  159. spread = {x = 100, y = 100, z = 100},
  160. seed = 137,
  161. octaves = 3,
  162. persist = 0.7,
  163. },
  164. biomes = {"deciduous_forest", "grassytwo", "jumble"},
  165. y_min = 1,
  166. y_max = 31000,
  167. schematic = dpath .. "bush.mts",
  168. flags = "place_center_x, place_center_z"
  169. })
  170. -- default acacia bush
  171. minetest.register_decoration({
  172. deco_type = "schematic",
  173. place_on = {
  174. "default:dirt_with_dry_grass", "default:dry_dirt_with_dry_grass"},
  175. sidelen = 16,
  176. noise_params = {
  177. offset = -0.004,
  178. scale = 0.01,
  179. spread = {x = 100, y = 100, z = 100},
  180. seed = 90155,
  181. octaves = 3,
  182. persist = 0.7,
  183. },
  184. biomes = {"savanna", "mesa"},
  185. y_min = 1,
  186. y_max = 31000,
  187. schematic = dpath .. "acacia_bush.mts",
  188. flags = "place_center_x, place_center_z"
  189. })
  190. -- default pine bush
  191. if minetest.registered_nodes["default:pine_bush"] then
  192. minetest.register_decoration({
  193. name = "default:pine_bush",
  194. deco_type = "schematic",
  195. place_on = {"default:dirt_with_snow"},
  196. sidelen = 16,
  197. noise_params = {
  198. offset = -0.004,
  199. scale = 0.01,
  200. spread = {x = 100, y = 100, z = 100},
  201. seed = 137,
  202. octaves = 3,
  203. persist = 0.7,
  204. },
  205. biomes = {"taiga"},
  206. y_max = 31000,
  207. y_min = 4,
  208. schematic = dpath .. "pine_bush.mts",
  209. flags = "place_center_x, place_center_z"
  210. })
  211. end
  212. -- default blueberry bush
  213. if minetest.registered_nodes["default:blueberry_bush_leaves"] then
  214. minetest.register_decoration({
  215. name = "default:blueberry_bush",
  216. deco_type = "schematic",
  217. place_on = {
  218. "default:dirt_with_coniferous_litter", "default:dirt_with_snow"},
  219. sidelen = 16,
  220. noise_params = {
  221. offset = -0.004,
  222. scale = 0.01,
  223. spread = {x = 100, y = 100, z = 100},
  224. seed = 697,
  225. octaves = 3,
  226. persist = 0.7,
  227. },
  228. biomes = {"coniferous_forest", "taiga"},
  229. y_max = 31000,
  230. y_min = 1,
  231. place_offset_y = 1,
  232. schematic = dpath .. "blueberry_bush.mts",
  233. flags = "place_center_x, place_center_z"
  234. })
  235. end
  236. -- place waterlily in beach areas
  237. minetest.register_decoration({
  238. deco_type = "schematic",
  239. place_on = {"default:sand"},
  240. sidelen = 16,
  241. noise_params = {
  242. offset = -0.12,
  243. scale = 0.3,
  244. spread = {x = 200, y = 200, z = 200},
  245. seed = 33,
  246. octaves = 3,
  247. persist = 0.7
  248. },
  249. biomes = {"desert_ocean", "plains_ocean", "sandclay",
  250. "mesa_ocean", "grove_ocean", "deciduous_forest_ocean", "swamp_ocean"},
  251. y_min = 0,
  252. y_max = 0,
  253. schematic = ethereal.waterlily,
  254. rotation = "random"
  255. })
  256. -- coral reef
  257. if ethereal.reefs == 1 then
  258. -- override corals so crystal shovel can pick them up intact
  259. minetest.override_item("default:coral_skeleton", {groups = {crumbly = 3}})
  260. minetest.override_item("default:coral_orange", {groups = {crumbly = 3}})
  261. minetest.override_item("default:coral_brown", {groups = {crumbly = 3}})
  262. minetest.register_decoration({
  263. deco_type = "schematic",
  264. place_on = {"default:sand"},
  265. noise_params = {
  266. offset = -0.15,
  267. scale = 0.1,
  268. spread = {x = 100, y = 100, z = 100},
  269. seed = 7013,
  270. octaves = 3,
  271. persist = 1,
  272. },
  273. biomes = {"desert_ocean", "grove_ocean"},
  274. y_min = -8,
  275. y_max = -2,
  276. schematic = path .. "corals.mts",
  277. flags = "place_center_x, place_center_z",
  278. rotation = "random"
  279. })
  280. end