mapgen.lua 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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_waterlily()
  71. end
  72. --
  73. -- All other biome API mapgens
  74. --
  75. local function register_flower(seed, name)
  76. minetest.register_decoration({
  77. deco_type = "simple",
  78. place_on = {"default:dirt_with_grass"},
  79. sidelen = 16,
  80. noise_params = {
  81. offset = -0.015,
  82. scale = 0.025,
  83. spread = {x = 200, y = 200, z = 200},
  84. seed = seed,
  85. octaves = 3,
  86. persist = 0.6
  87. },
  88. biomes = {"grassland", "deciduous_forest", "coniferous_forest"},
  89. y_min = 1,
  90. y_max = 31000,
  91. decoration = "flowers:"..name,
  92. })
  93. end
  94. local function register_mushroom(name)
  95. minetest.register_decoration({
  96. deco_type = "simple",
  97. place_on = {"default:dirt_with_grass"},
  98. sidelen = 16,
  99. noise_params = {
  100. offset = 0,
  101. scale = 0.006,
  102. spread = {x = 250, y = 250, z = 250},
  103. seed = 2,
  104. octaves = 3,
  105. persist = 0.66
  106. },
  107. biomes = {"deciduous_forest", "coniferous_forest"},
  108. y_min = 1,
  109. y_max = 31000,
  110. decoration = "flowers:"..name,
  111. })
  112. end
  113. local function register_waterlily()
  114. minetest.register_decoration({
  115. deco_type = "schematic",
  116. place_on = {"default:dirt"},
  117. sidelen = 16,
  118. noise_params = {
  119. offset = -0.12,
  120. scale = 0.3,
  121. spread = {x = 200, y = 200, z = 200},
  122. seed = 33,
  123. octaves = 3,
  124. persist = 0.7
  125. },
  126. biomes = {"rainforest_swamp", "savanna_shore", "deciduous_forest_shore"},
  127. y_min = 0,
  128. y_max = 0,
  129. schematic = minetest.get_modpath("flowers") .. "/schematics/waterlily.mts",
  130. rotation = "random",
  131. })
  132. end
  133. function flowers.register_decorations()
  134. register_flower(436, "rose")
  135. register_flower(19822, "tulip")
  136. register_flower(1220999, "dandelion_yellow")
  137. register_flower(36662, "geranium")
  138. register_flower(1133, "viola")
  139. register_flower(73133, "dandelion_white")
  140. register_mushroom("mushroom_brown")
  141. register_mushroom("mushroom_red")
  142. register_waterlily()
  143. end
  144. --
  145. -- Detect mapgen to select functions
  146. --
  147. local mg_name = minetest.get_mapgen_setting("mg_name")
  148. if mg_name == "v6" then
  149. flowers.register_mgv6_decorations()
  150. else
  151. flowers.register_decorations()
  152. end