DS
2017-06-05 9167d4fc6f8ff3986fea507ca9d22cc69511c28d
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
eb344a 121 local sulfur_buf = nil
VE 122 local sulfur_noise= nil
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)]
eb344a 144         if (c == c_lava or c == c_lava_flowing) and sulfur_noise:get3d({x = x, y = z, z = z}) >= 0.4 then
3eefa2 145             for xx = math.max(minp.x, x - grid_size), math.min(maxp.x, x + grid_size) do
N 146             for yy = math.max(minp.y, y - grid_size), math.min(maxp.y, y + grid_size) do
147             for zz = math.max(minp.z, z - grid_size), math.min(maxp.z, z + grid_size) do
148                 local i = a:index(xx, yy, zz)
149                 if data[i] == c_stone and pr:next(1, 10) <= 7 then
150                     data[i] = c_sulfur
151                 end
152             end
153             end
154             end
155         end
156     end
157     end
158     end
eb344a 159
3eefa2 160     vm:set_data(data)
N 161     vm:write_to_map(data)
162 end)
163
164
ee0765 165 if technic.config:get_bool("enable_marble_generation") then
279776 166 minetest.register_ore({
R 167     ore_type       = "sheet",
168     ore            = "technic:marble",
169     wherein        = "default:stone",
170     clust_scarcity = 1,
171     clust_num_ores = 1,
172     clust_size     = 3,
19f74d 173     y_min     = -31000,
M 174     y_max     = -50,
b67bca 175     noise_threshold = 0.4,
279776 176     noise_params = {offset=0, scale=15, spread={x=150, y=150, z=150}, seed=23, octaves=3, persist=0.70}
R 177 })
003286 178 end
ee0765 179
S 180 if technic.config:get_bool("enable_granite_generation") then
279776 181 minetest.register_ore({
R 182     ore_type       = "sheet",
183     ore            = "technic:granite",
184     wherein        = "default:stone",
185     clust_scarcity = 1,
186     clust_num_ores = 1,
187     clust_size     = 4,
19f74d 188     y_min     = -31000,
M 189     y_max     = -150,
b67bca 190     noise_threshold = 0.4,
279776 191     noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70}
R 192 })
003286 193 end
279776 194