mapgen.lua 3.9 KB

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