oregen.lua 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. -- Copyright (C) 2020 2024 PsycoJaker
  2. -- This file is part of UwU Minetest Mod.
  3. -- UwU Mod is free software: you can redistribute it and/or modify
  4. -- it under the terms of the GNU Affero General Public License as
  5. -- published by the Free Software Foundation, either version 3 of the
  6. -- License, or (at your option) any later version.
  7. -- UwU Mod is distributed in the hope that it will be useful,
  8. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. -- GNU Affero General Public License for more details.
  11. -- You should have received a copy of the GNU Affero General Public License
  12. -- along with UwU Mod. If not, see <https://www.gnu.org/licenses/>.
  13. local stonelike = {"mcl_amethyst:amethyst_block", "mcl_amethyst:calcite", "mcl_amethyst:basalt_smooth"}
  14. -- Common spawn
  15. core.register_ore({
  16. ore_type = "scatter",
  17. ore = "uwu:ore",
  18. wherein = stonelike,
  19. clust_scarcity = 10000,
  20. clust_num_ores = 4,
  21. clust_size = 3,
  22. y_min = mcl_vars.mg_overworld_min,
  23. y_max = mcl_worlds.layer_to_y(12),
  24. })
  25. core.register_ore({
  26. ore_type = "scatter",
  27. ore = "uwu:ore",
  28. wherein = stonelike,
  29. clust_scarcity = 5000,
  30. clust_num_ores = 2,
  31. clust_size = 2,
  32. y_min = mcl_vars.mg_overworld_min,
  33. y_max = mcl_worlds.layer_to_y(12),
  34. })
  35. core.register_ore({
  36. ore_type = "scatter",
  37. ore = "uwu:ore",
  38. wherein = stonelike,
  39. clust_scarcity = 10000,
  40. clust_num_ores = 8,
  41. clust_size = 3,
  42. y_min = mcl_vars.mg_overworld_min,
  43. y_max = mcl_worlds.layer_to_y(12),
  44. })
  45. local all_directions = {
  46. vector.new(1, 0, 0),
  47. vector.new(0, 1, 0),
  48. vector.new(0, 0, 1),
  49. vector.new(-1, 0, 0),
  50. vector.new(0, -1, 0),
  51. vector.new(0, 0, -1),
  52. }
  53. minetest.register_abm({
  54. label = "Spawn UwU crystal",
  55. nodenames = {"mcl_amethyst:budding_amethyst_block", "uwu:ore"},
  56. neighbors = {"air", "group:water"},
  57. interval = 35,
  58. chance = 3,
  59. action = function(pos)
  60. local check_pos = vector.add(all_directions[math.random(1, #all_directions)], pos)
  61. local check_node = minetest.get_node(check_pos)
  62. local check_node_name = check_node.name
  63. if check_node_name ~= "air" and minetest.get_item_group(check_node_name, "water") == 0 then return end
  64. local param2 = minetest.dir_to_wallmounted(vector.subtract(pos, check_pos))
  65. local new_node = {name = "uwu:crystal", param2 = param2}
  66. minetest.swap_node(check_pos, new_node)
  67. end,
  68. })