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