mapgen.lua 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. local function register_mgv6_flower(name, seed)
  2. local seed = seed or 0
  3. minetest.register_decoration({
  4. deco_type = "simple",
  5. place_on = {"default:dirt_with_grass"},
  6. sidelen = 16,
  7. noise_params = {
  8. offset = -0.01,
  9. scale = 0.03,
  10. spread = {x = 10, y = 10, z = 10},
  11. seed = 436+seed,
  12. octaves = 3,
  13. persist = 0.5
  14. },
  15. y_min = 1,
  16. y_max = 300,
  17. decoration = "flowers:"..name,
  18. })
  19. end
  20. local function register_mgv6_mushroom(name, seed)
  21. local seed = seed or 0
  22. minetest.register_decoration({
  23. deco_type = "simple",
  24. place_on = {"default:dirt_with_grass"},
  25. sidelen = 16,
  26. noise_params = {
  27. offset = 0,
  28. scale = 0.04,
  29. spread = {x = 100, y = 100, z = 100},
  30. seed = 7133+seed,
  31. octaves = 3,
  32. persist = 0.6
  33. },
  34. y_min = 1,
  35. y_max = 300,
  36. decoration = "flowers:"..name,
  37. spawn_by = "group:tree",
  38. num_spawn_by = 1,
  39. })
  40. end
  41. function flowers.register_mgv6_decorations()
  42. register_mgv6_flower("rose", 1)
  43. register_mgv6_flower("tulip", 2)
  44. register_mgv6_flower("dandelion_yellow", 3)
  45. register_mgv6_flower("geranium", 4)
  46. register_mgv6_flower("viola", 5)
  47. register_mgv6_flower("dandelion_white", 6)
  48. register_mgv6_mushroom("mushroom_brown", 1)
  49. register_mgv6_mushroom("mushroom_red", 2)
  50. -- TODO: Add waterlily
  51. -- register_mgv6_waterlily()
  52. end
  53. --
  54. -- Detect mapgen to select functions
  55. --
  56. -- TODO: Other mapgens
  57. -- local mg_name = minetest.get_mapgen_setting("mg_name")
  58. -- if mg_name == "v6" then
  59. flowers.register_mgv6_decorations()
  60. -- else
  61. -- flowers.register_decorations()
  62. -- end