mapgen.lua 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. -- mods/default/mapgen.lua
  2. --
  3. -- Aliases for map generator outputs
  4. --
  5. minetest.register_alias("mapgen_air", "air")
  6. minetest.register_alias("mapgen_stone", "default:stone")
  7. minetest.register_alias("mapgen_water_source", "default:water_source")
  8. minetest.register_alias("mapgen_river_water_source", "default:river_water_source")
  9. minetest.register_alias("mapgen_dirt", "default:dirt")
  10. minetest.register_alias("mapgen_sand", "default:sand")
  11. minetest.register_alias("mapgen_gravel", "default:gravel")
  12. minetest.register_alias("mapgen_lava_source", "default:lava_source")
  13. minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass")
  14. minetest.register_alias("mapgen_dirt_with_snow", "default:dirt_with_snow")
  15. minetest.register_alias("mapgen_snow", "default:snow")
  16. minetest.register_alias("mapgen_snowblock", "default:snowblock")
  17. minetest.register_alias("mapgen_ice", "default:ice")
  18. -- Flora
  19. minetest.register_alias("mapgen_tree", "default:tree")
  20. minetest.register_alias("mapgen_leaves", "default:leaves")
  21. minetest.register_alias("mapgen_apple", "default:apple")
  22. minetest.register_alias("mapgen_jungletree", "default:jungletree")
  23. minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves")
  24. minetest.register_alias("mapgen_junglegrass", "default:junglegrass")
  25. -- Dungeons
  26. minetest.register_alias("mapgen_cobble", "default:cobble")
  27. minetest.register_alias("mapgen_mossycobble", "default:mossycobble")
  28. minetest.register_alias("mapgen_desert_sand", "default:desert_sand")
  29. minetest.register_alias("mapgen_desert_stone", "default:desert_stone")
  30. minetest.register_alias("mapgen_stair_cobble", "stairsplus:stair_cobble")
  31. minetest.register_alias("mapgen_sandstone", "default:sandstone")
  32. minetest.register_alias("mapgen_sandstonebrick", "default:sandstone")
  33. minetest.register_alias("mapgen_stair_sandstone", "stairsplus:stair_sandstone")
  34. --
  35. -- Ore generation
  36. --
  37. minetest.register_ore({
  38. ore_type = "sheet",
  39. ore = "default:granite",
  40. wherein = {"default:stone", "default:desert_stone"},
  41. column_height_min = 1,
  42. column_height_max = 8,
  43. column_midpoint_factor = 0.3,
  44. noise_params = {
  45. offset = -1.3,
  46. scale = 3,
  47. spread = {x=100, y=100, z=100},
  48. seed = 79533,
  49. octaves = 3,
  50. persist = 0.5,
  51. flags = "eased",
  52. },
  53. noise_threshold = 1.6,
  54. y_min = -31000,
  55. y_max = 64,
  56. })
  57. minetest.register_ore({
  58. ore_type = "sheet",
  59. ore = "default:sandstone",
  60. wherein = {"default:stone", "default:desert_stone"},
  61. column_height_min = 1,
  62. column_height_max = 10,
  63. column_midpoint_factor = 0.3,
  64. noise_params = {
  65. offset = -1.3,
  66. scale = 3,
  67. spread = {x=100, y=100, z=100},
  68. seed = 18953,
  69. octaves = 3,
  70. persist = 0.5,
  71. flags = "eased",
  72. },
  73. noise_threshold = 1.6,
  74. y_min = -31000,
  75. y_max = 64,
  76. })
  77. minetest.register_ore({
  78. ore_type = "scatter",
  79. ore = "default:gravel",
  80. wherein = {"default:dirt", "default:stone"},
  81. clust_scarcity = 16*16*16,
  82. clust_num_ores = 48,
  83. clust_size = 4,
  84. y_max = 31000,
  85. y_min = -31000,
  86. })
  87. minetest.register_ore({
  88. ore_type = "scatter",
  89. ore = "default:sand",
  90. wherein = {"default:dirt", "default:stone"},
  91. clust_scarcity = 22*22*22,
  92. clust_num_ores = 48,
  93. clust_size = 4,
  94. y_max = 31000,
  95. y_min = -31000,
  96. })
  97. minetest.register_ore({
  98. ore_type = "scatter",
  99. ore = "default:ice",
  100. wherein = {"default:stone"},
  101. clust_scarcity = 30*30*30,
  102. clust_num_ores = 96,
  103. clust_size = 5,
  104. y_max = -512,
  105. y_min = -31000,
  106. })
  107. minetest.register_ore({
  108. ore_type = "scatter",
  109. ore = "default:stone_with_coal",
  110. wherein = "default:stone",
  111. clust_scarcity = 12*12*12,
  112. clust_num_ores = 8,
  113. clust_size = 3,
  114. y_min = -31000,
  115. y_max = 64,
  116. })
  117. minetest.register_ore({
  118. ore_type = "scatter",
  119. ore = "default:stone_with_iron",
  120. wherein = "default:stone",
  121. clust_scarcity = 17*17*17,
  122. clust_num_ores = 5,
  123. clust_size = 3,
  124. y_min = -127,
  125. y_max = -64,
  126. })
  127. minetest.register_ore({
  128. ore_type = "scatter",
  129. ore = "default:stone_with_iron",
  130. wherein = "default:stone",
  131. clust_scarcity = 14*14*14,
  132. clust_num_ores = 5,
  133. clust_size = 3,
  134. y_min = -31000,
  135. y_max = -128,
  136. })
  137. minetest.register_ore({
  138. ore_type = "scatter",
  139. ore = "default:stone_with_iron",
  140. wherein = "default:stone",
  141. clust_scarcity = 25*25*25,
  142. clust_num_ores = 20,
  143. clust_size = 6,
  144. y_min = -31000,
  145. y_max = -64,
  146. })
  147. minetest.register_ore({
  148. ore_type = "scatter",
  149. ore = "default:stone_with_mese",
  150. wherein = "default:stone",
  151. clust_scarcity = 25*25*25,
  152. clust_num_ores = 3,
  153. clust_size = 2,
  154. y_min = -511,
  155. y_max = -256,
  156. })
  157. minetest.register_ore({
  158. ore_type = "scatter",
  159. ore = "default:stone_with_mese",
  160. wherein = "default:stone",
  161. clust_scarcity = 20*20*20,
  162. clust_num_ores = 5,
  163. clust_size = 3,
  164. y_min = -31000,
  165. y_max = -512,
  166. })
  167. minetest.register_ore({
  168. ore_type = "scatter",
  169. ore = "default:mese",
  170. wherein = "default:stone",
  171. clust_scarcity = 42*42*42,
  172. clust_num_ores = 3,
  173. clust_size = 2,
  174. y_min = -31000,
  175. y_max = -1024,
  176. })
  177. minetest.register_ore({
  178. ore_type = "scatter",
  179. ore = "default:stone_with_copper",
  180. wherein = "default:stone",
  181. clust_scarcity = 10*10*10,
  182. clust_num_ores = 3,
  183. clust_size = 3,
  184. y_min = -127,
  185. y_max = 16,
  186. })
  187. minetest.register_ore({
  188. ore_type = "scatter",
  189. ore = "default:stone_with_copper",
  190. wherein = "default:stone",
  191. clust_scarcity = 12*12*12,
  192. clust_num_ores = 5,
  193. clust_size = 3,
  194. y_min = -1023,
  195. y_max = -128,
  196. })
  197. minetest.register_ore({
  198. ore_type = "scatter",
  199. ore = "default:stone_with_tin",
  200. wherein = "default:stone",
  201. clust_scarcity = 14*14*14,
  202. clust_num_ores = 3,
  203. clust_size = 3,
  204. y_min = -1023,
  205. y_max = 0,
  206. })
  207. minetest.register_ore({
  208. ore_type = "scatter",
  209. ore = "default:stone_with_copper",
  210. wherein = "default:stone",
  211. clust_scarcity = 14*14*14,
  212. clust_num_ores = 5,
  213. clust_size = 3,
  214. y_min = -31000,
  215. y_max = -1024,
  216. })
  217. minetest.register_ore({
  218. ore_type = "scatter",
  219. ore = "default:stone_with_tin",
  220. wherein = "default:stone",
  221. clust_scarcity = 16*16*16,
  222. clust_num_ores = 3,
  223. clust_size = 3,
  224. y_min = -31000,
  225. y_max = -1024,
  226. })
  227. minetest.register_ore({
  228. ore_type = "scatter",
  229. ore = "default:coalblock",
  230. wherein = "default:stone",
  231. clust_scarcity = 16*16*16,
  232. clust_num_ores = 32,
  233. clust_size = 4,
  234. y_min = -4096,
  235. y_max = -2048,
  236. })
  237. minetest.register_ore({
  238. ore_type = "scatter",
  239. ore = "default:clay",
  240. wherein = "default:sand",
  241. clust_scarcity = 20*20*20,
  242. clust_num_ores = 32,
  243. clust_size = 6,
  244. y_max = 0,
  245. y_min = -10,
  246. })
  247. minetest.register_ore({
  248. ore_type = "scatter",
  249. ore = "default:clay",
  250. wherein = "default:dirt",
  251. clust_scarcity = 20*20*20,
  252. clust_num_ores = 32,
  253. clust_size = 6,
  254. y_max = 16,
  255. y_min = -10,
  256. })
  257. minetest.register_ore({
  258. ore_type = "scatter",
  259. ore = "default:stone_crumbled",
  260. wherein = "default:stone",
  261. clust_scarcity = 11*11*11,
  262. clust_num_ores = 20,
  263. clust_size = 4,
  264. y_min = -32,
  265. y_max = 1024,
  266. })
  267. function default.make_papyrus(pos, size)
  268. for y=0,size-1 do
  269. local p = {x=pos.x, y=pos.y+y, z=pos.z}
  270. local nn = minetest.get_node(p).name
  271. if minetest.registered_nodes[nn] and
  272. minetest.registered_nodes[nn].buildable_to then
  273. minetest.set_node(p, {name="default:papyrus"})
  274. else
  275. return
  276. end
  277. end
  278. end
  279. function default.register_mgv6_decorations()
  280. -- Cacti
  281. minetest.register_decoration({
  282. deco_type = "simple",
  283. place_on = {"default:desert_sand"},
  284. sidelen = 16,
  285. noise_params = {
  286. offset = -0.012,
  287. scale = 0.024,
  288. spread = {x = 100, y = 100, z = 100},
  289. seed = 230,
  290. octaves = 3,
  291. persist = 0.6
  292. },
  293. y_min = 1,
  294. y_max = 300,
  295. decoration = "default:cactus",
  296. height = 3,
  297. height_max = 5,
  298. })
  299. -- Long grasses
  300. for length = 1, 5 do
  301. minetest.register_decoration({
  302. deco_type = "simple",
  303. place_on = {"default:dirt_with_grass"},
  304. sidelen = 16,
  305. noise_params = {
  306. offset = 0,
  307. scale = 0.06,
  308. spread = {x = 100, y = 100, z = 100},
  309. seed = 329,
  310. octaves = 3,
  311. persist = 0.8
  312. },
  313. y_min = 1,
  314. y_max = 300,
  315. decoration = "default:grass_"..length,
  316. })
  317. end
  318. -- Ferns
  319. for length = 1, 3 do
  320. minetest.register_decoration({
  321. deco_type = "simple",
  322. place_on = {"default:dirt_with_grass"},
  323. sidelen = 16,
  324. noise_params = {
  325. offset = 0,
  326. scale = 0.04,
  327. spread = {x = 100, y = 100, z = 100},
  328. seed = 800+length,
  329. octaves = 3,
  330. persist = 0.65
  331. },
  332. y_min = 6,
  333. y_max = 31000,
  334. decoration = "default:fern_" .. length,
  335. })
  336. end
  337. -- Dry shrubs
  338. minetest.register_decoration({
  339. deco_type = "simple",
  340. place_on = {"default:desert_sand"},
  341. sidelen = 16,
  342. noise_params = {
  343. offset = 0,
  344. scale = 0.035,
  345. spread = {x = 100, y = 100, z = 100},
  346. seed = 329,
  347. octaves = 3,
  348. persist = 0.6
  349. },
  350. y_min = 1,
  351. y_max = 300,
  352. decoration = "default:dry_shrub",
  353. })
  354. -- Corals
  355. minetest.register_decoration({
  356. deco_type = "simple",
  357. place_on = {"default:sand"},
  358. sidelen = 16,
  359. noise_params = {
  360. offset = -0.5,
  361. scale = 0.60,
  362. spread = {x = 100, y = 100, z = 100},
  363. seed = 7013,
  364. octaves = 3,
  365. persist = 0.1,
  366. },
  367. y_min = -64,
  368. y_max = -2,
  369. decoration = "default:coral_brown",
  370. height = 1,
  371. height_max = 2,
  372. flags = "force_placement",
  373. })
  374. minetest.register_decoration({
  375. deco_type = "simple",
  376. place_on = {"default:sand"},
  377. sidelen = 16,
  378. noise_params = {
  379. offset = -0.5,
  380. scale = 0.64,
  381. spread = {x = 100, y = 100, z = 100},
  382. seed = 7013,
  383. octaves = 3,
  384. persist = 0.1,
  385. },
  386. y_min = -64,
  387. y_max = -2,
  388. decoration = "default:coral_orange",
  389. height = 1,
  390. height_max = 2,
  391. flags = "force_placement",
  392. })
  393. minetest.register_decoration({
  394. deco_type = "simple",
  395. place_on = {"default:sand"},
  396. sidelen = 16,
  397. noise_params = {
  398. offset = -0.5,
  399. scale = 0.63,
  400. spread = {x = 100, y = 100, z = 100},
  401. seed = 7013,
  402. octaves = 3,
  403. persist = 0.1,
  404. },
  405. y_min = -64,
  406. y_max = -2,
  407. decoration = "default:coral_purple",
  408. height = 1,
  409. height_max = 2,
  410. flags = "force_placement",
  411. })
  412. -- Seaweed
  413. minetest.register_decoration({
  414. deco_type = "schematic",
  415. place_on = {"default:dirt"},
  416. -- Same params as grass.
  417. sidelen = 16,
  418. noise_params = {
  419. offset = 0,
  420. scale = 0.06,
  421. spread = {x = 100, y = 100, z = 100},
  422. seed = 329,
  423. octaves = 3,
  424. persist = 0.8
  425. },
  426. y_min = -64,
  427. y_max = -2,
  428. -- We use a schematic to replace the dirt.
  429. schematic = {
  430. size = {x = 1, y = 1, z = 1},
  431. data = { {name = "default:seaweed"} },
  432. },
  433. flags = "force_placement",
  434. })
  435. end
  436. default.register_mgv6_decorations()