mapgen.lua 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. --
  2. -- Mgv6
  3. --
  4. local function register_mgv6_flower(name)
  5. minetest.register_decoration({
  6. deco_type = "simple",
  7. place_on = {"default:dirt_with_grass"},
  8. sidelen = 16,
  9. noise_params = {
  10. offset = 0,
  11. scale = 0.006,
  12. spread = {x = 100, y = 100, z = 100},
  13. seed = 436,
  14. octaves = 3,
  15. persist = 0.6
  16. },
  17. y_min = 1,
  18. y_max = 30,
  19. decoration = "flowers:"..name,
  20. })
  21. end
  22. local function register_mgv6_mushroom(name)
  23. minetest.register_decoration({
  24. deco_type = "simple",
  25. place_on = {"default:dirt_with_grass"},
  26. sidelen = 16,
  27. noise_params = {
  28. offset = 0,
  29. scale = 0.04,
  30. spread = {x = 100, y = 100, z = 100},
  31. seed = 7133,
  32. octaves = 3,
  33. persist = 0.6
  34. },
  35. y_min = 1,
  36. y_max = 30,
  37. decoration = "flowers:"..name,
  38. spawn_by = "default:tree",
  39. num_spawn_by = 1,
  40. })
  41. end
  42. local function register_mgv6_waterlily()
  43. minetest.register_decoration({
  44. deco_type = "schematic",
  45. place_on = {"default:dirt"},
  46. sidelen = 16,
  47. noise_params = {
  48. offset = -0.12,
  49. scale = 0.3,
  50. spread = {x = 100, y = 100, z = 100},
  51. seed = 33,
  52. octaves = 3,
  53. persist = 0.7
  54. },
  55. y_min = 0,
  56. y_max = 0,
  57. schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts",
  58. rotation = "random",
  59. })
  60. end
  61. function flowers.register_mgv6_decorations()
  62. register_mgv6_flower("rose")
  63. register_mgv6_flower("tulip")
  64. register_mgv6_flower("dandelion_yellow")
  65. register_mgv6_flower("geranium")
  66. register_mgv6_flower("viola")
  67. register_mgv6_flower("dandelion_white")
  68. register_mgv6_mushroom("mushroom_brown")
  69. register_mgv6_mushroom("mushroom_red")
  70. register_mgv6_mushroom("mushroom_jade")
  71. register_mgv6_mushroom("mushroom_french")
  72. register_mgv6_mushroom("mushroom_lemon")
  73. register_mgv6_mushroom("mushroom_sleepy")
  74. register_mgv6_waterlily()
  75. end
  76. --
  77. -- All other biome API mapgens
  78. --
  79. local function register_flower(seed, name)
  80. minetest.register_decoration({
  81. deco_type = "simple",
  82. place_on = {"default:dirt_with_grass"},
  83. sidelen = 16,
  84. noise_params = {
  85. offset = -0.02,
  86. scale = 0.04,
  87. spread = {x = 200, y = 200, z = 200},
  88. seed = seed,
  89. octaves = 3,
  90. persist = 0.6
  91. },
  92. biomes = {"grassland", "deciduous_forest", "coniferous_forest",
  93. "floatland_grassland"},
  94. y_min = 1,
  95. y_max = 31000,
  96. decoration = "flowers:"..name,
  97. })
  98. end
  99. local function register_mushroom(name)
  100. minetest.register_decoration({
  101. deco_type = "simple",
  102. place_on = {"default:dirt_with_grass"},
  103. sidelen = 16,
  104. noise_params = {
  105. offset = 0,
  106. scale = 0.006,
  107. spread = {x = 250, y = 250, z = 250},
  108. seed = 2,
  109. octaves = 3,
  110. persist = 0.66
  111. },
  112. biomes = {"deciduous_forest", "coniferous_forest"},
  113. y_min = 1,
  114. y_max = 31000,
  115. decoration = "flowers:"..name,
  116. })
  117. end
  118. local function register_waterlily()
  119. minetest.register_decoration({
  120. deco_type = "schematic",
  121. place_on = {"default:dirt"},
  122. sidelen = 16,
  123. noise_params = {
  124. offset = -0.12,
  125. scale = 0.3,
  126. spread = {x = 200, y = 200, z = 200},
  127. seed = 33,
  128. octaves = 3,
  129. persist = 0.7
  130. },
  131. biomes = {"rainforest_swamp", "savanna_shore", "deciduous_forest_shore"},
  132. y_min = 0,
  133. y_max = 0,
  134. schematic = minetest.get_modpath("flowers") .. "/schematics/waterlily.mts",
  135. rotation = "random",
  136. })
  137. end
  138. function flowers.register_decorations()
  139. register_flower(436, "rose")
  140. register_flower(19822, "tulip")
  141. register_flower(1220999, "dandelion_yellow")
  142. register_flower(36662, "geranium")
  143. register_flower(1133, "viola")
  144. register_flower(73133, "dandelion_white")
  145. register_mushroom("mushroom_brown")
  146. register_mushroom("mushroom_red")
  147. register_mgv6_mushroom("mushroom_jade")
  148. register_mgv6_mushroom("mushroom_french")
  149. register_mgv6_mushroom("mushroom_lemon")
  150. register_mgv6_mushroom("mushroom_sleepy")
  151. register_waterlily()
  152. end
  153. --
  154. -- Detect mapgen to select functions
  155. --
  156. local mg_name = minetest.get_mapgen_setting("mg_name")
  157. if mg_name == "v6" then
  158. flowers.register_mgv6_decorations()
  159. else
  160. flowers.register_decorations()
  161. end