HybridDog
2018-07-16 6af0376c23e000b7e2cd4db2659ff5d632c4e60b
commit | author | age
390ade 1 local uranium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 420, octaves = 3, persist = 0.7}
b67bca 2 local uranium_threshold = 0.55
390ade 3
N 4 local chromium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 421, octaves = 3, persist = 0.7}
b67bca 5 local chromium_threshold = 0.55
390ade 6
N 7 local zinc_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 422, octaves = 3, persist = 0.7}
b67bca 8 local zinc_threshold = 0.5
390ade 9
3eefa2 10 local lead_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 423, octaves = 3, persist = 0.7}
b67bca 11 local lead_threshold = 0.3
3eefa2 12
279776 13 minetest.register_ore({
390ade 14     ore_type         = "scatter",
N 15     ore              = "technic:mineral_uranium",
16     wherein          = "default:stone",
17     clust_scarcity   = 8*8*8,
18     clust_num_ores   = 4,
19     clust_size       = 3,
19f74d 20     y_min       = -300,
M 21     y_max       = -80,
390ade 22     noise_params     = uranium_params,
b67bca 23     noise_threshold = uranium_threshold,
279776 24 })
ee0765 25
279776 26 minetest.register_ore({
390ade 27     ore_type         = "scatter",
N 28     ore              = "technic:mineral_chromium",
29     wherein          = "default:stone",
30     clust_scarcity   = 8*8*8,
31     clust_num_ores   = 2,
32     clust_size       = 3,
19f74d 33     y_min       = -200,
M 34     y_max       = -100,
390ade 35     noise_params     = chromium_params,
b67bca 36     noise_threshold = chromium_threshold,
279776 37 })
ee0765 38
279776 39 minetest.register_ore({
390ade 40     ore_type         = "scatter",
N 41     ore              = "technic:mineral_chromium",
42     wherein          = "default:stone",
43     clust_scarcity   = 6*6*6,
44     clust_num_ores   = 2,
45     clust_size       = 3,
19f74d 46     y_min       = -31000,
M 47     y_max       = -200,
390ade 48     flags            = "absheight",
N 49     noise_params     = chromium_params,
b67bca 50     noise_threshold = chromium_threshold,
390ade 51 })
N 52
53 minetest.register_ore({
54     ore_type         = "scatter",
55     ore              = "technic:mineral_zinc",
56     wherein          = "default:stone",
b7cecd 57     clust_scarcity   = 8*8*8,
f9a859 58     clust_num_ores   = 5,
M 59     clust_size       = 7,
19f74d 60     y_min       = -32,
b67bca 61     y_max       = 2,
M 62     noise_params     = zinc_params,
63     noise_threshold = zinc_threshold,
390ade 64 })
N 65
66 minetest.register_ore({
67     ore_type         = "scatter",
68     ore              = "technic:mineral_zinc",
69     wherein          = "default:stone",
70     clust_scarcity   = 6*6*6,
71     clust_num_ores   = 4,
72     clust_size       = 3,
19f74d 73     y_min       = -31000,
M 74     y_max       = -32,
390ade 75     flags            = "absheight",
N 76     noise_params     = zinc_params,
b67bca 77     noise_threshold = zinc_threshold,
279776 78 })
ee0765 79
3eefa2 80 minetest.register_ore({
N 81     ore_type         = "scatter",
82     ore              = "technic:mineral_lead",
83     wherein          = "default:stone",
84     clust_scarcity   = 9*9*9,
85     clust_num_ores   = 5,
86     clust_size       = 3,
19f74d 87     y_min       = -16,
M 88     y_max       = 16,
3eefa2 89     noise_params     = lead_params,
b67bca 90     noise_threshold = lead_threshold,
3eefa2 91 })
N 92
93 minetest.register_ore({
94     ore_type         = "scatter",
95     ore              = "technic:mineral_lead",
96     wherein          = "default:stone",
97     clust_scarcity   = 8*8*8,
98     clust_num_ores   = 5,
99     clust_size       = 3,
19f74d 100     y_min       = -128,
M 101     y_max       = -16,
3eefa2 102     noise_params     = lead_params,
b67bca 103     noise_threshold = lead_threshold,
3eefa2 104 })
N 105
106 minetest.register_ore({
107     ore_type         = "scatter",
108     ore              = "technic:mineral_lead",
109     wherein          = "default:stone",
110     clust_scarcity   = 6*6*6,
111     clust_num_ores   = 5,
112     clust_size       = 3,
19f74d 113     y_min       = -31000,
M 114     y_max       = -128,
3eefa2 115     flags            = "absheight",
N 116     noise_params     = lead_params,
b67bca 117     noise_threshold = lead_threshold,
3eefa2 118 })
N 119
120 -- Sulfur
a49554 121 local sulfur_buf = {}
eb344a 122 local sulfur_noise= nil
VE 123
3eefa2 124 minetest.register_on_generated(function(minp, maxp, seed)
N 125     local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
126     local a = VoxelArea:new{
127         MinEdge = {x = emin.x, y = emin.y, z = emin.z},
128         MaxEdge = {x = emax.x, y = emax.y, z = emax.z},
129     }
eb344a 130     local data = vm:get_data(sulfur_buf)
3eefa2 131     local pr = PseudoRandom(17 * minp.x + 42 * minp.y + 101 * minp.z)
eb344a 132     sulfur_noise = sulfur_noise or minetest.get_perlin(9876, 3, 0.5, 100)
VE 133
3eefa2 134     local c_lava = minetest.get_content_id("default:lava_source")
N 135     local c_lava_flowing = minetest.get_content_id("default:lava_flowing")
136     local c_stone = minetest.get_content_id("default:stone")
137     local c_sulfur = minetest.get_content_id("technic:mineral_sulfur")
eb344a 138
3eefa2 139     local grid_size = 5
N 140     for x = minp.x + math.floor(grid_size / 2), maxp.x, grid_size do
141     for y = minp.y + math.floor(grid_size / 2), maxp.y, grid_size do
142     for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do
143         local c = data[a:index(x, y, z)]
6af037 144         if (c == c_lava or c == c_lava_flowing)
H 145         and sulfur_noise:get3d({x = x, y = z, z = z}) >= 0.4 then
146             for i in a:iter(
147                 math.max(minp.x, x - grid_size),
148                 math.max(minp.y, y - grid_size),
149                 math.max(minp.z, z - grid_size),
150                 math.min(maxp.x, x + grid_size),
151                 math.min(maxp.y, y + grid_size),
152                 math.min(maxp.z, z + grid_size)
153             ) do
3eefa2 154                 if data[i] == c_stone and pr:next(1, 10) <= 7 then
N 155                     data[i] = c_sulfur
156                 end
157             end
158         end
159     end
160     end
161     end
eb344a 162
3eefa2 163     vm:set_data(data)
N 164     vm:write_to_map(data)
165 end)
166
167
ee0765 168 if technic.config:get_bool("enable_marble_generation") then
279776 169 minetest.register_ore({
R 170     ore_type       = "sheet",
171     ore            = "technic:marble",
172     wherein        = "default:stone",
173     clust_scarcity = 1,
174     clust_num_ores = 1,
175     clust_size     = 3,
19f74d 176     y_min     = -31000,
M 177     y_max     = -50,
b67bca 178     noise_threshold = 0.4,
279776 179     noise_params = {offset=0, scale=15, spread={x=150, y=150, z=150}, seed=23, octaves=3, persist=0.70}
R 180 })
003286 181 end
ee0765 182
S 183 if technic.config:get_bool("enable_granite_generation") then
279776 184 minetest.register_ore({
R 185     ore_type       = "sheet",
186     ore            = "technic:granite",
187     wherein        = "default:stone",
188     clust_scarcity = 1,
189     clust_num_ores = 1,
190     clust_size     = 4,
19f74d 191     y_min     = -31000,
M 192     y_max     = -150,
b67bca 193     noise_threshold = 0.4,
279776 194     noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70}
R 195 })
003286 196 end
279776 197