schems.lua 8.2 KB

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