Tidy up ore registrations (#422)

This commit is contained in:
HybridDog 2018-07-21 19:09:27 +02:00 committed by SmallJoker
parent fb93388f06
commit 80c6a14566
1 changed files with 141 additions and 111 deletions

View File

@ -1,13 +1,41 @@
local uranium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 420, octaves = 3, persist = 0.7}
local uranium_params = {
offset = 0,
scale = 1,
spread = {x = 100, y = 100, z = 100},
seed = 420,
octaves = 3,
persist = 0.7
}
local uranium_threshold = 0.55
local chromium_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 421, octaves = 3, persist = 0.7}
local chromium_params = {
offset = 0,
scale = 1,
spread = {x = 100, y = 100, z = 100},
seed = 421,
octaves = 3,
persist = 0.7
}
local chromium_threshold = 0.55
local zinc_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 422, octaves = 3, persist = 0.7}
local zinc_params = {
offset = 0,
scale = 1,
spread = {x = 100, y = 100, z = 100},
seed = 422,
octaves = 3,
persist = 0.7
}
local zinc_threshold = 0.5
local lead_params = {offset = 0, scale = 1, spread = {x = 100, y = 100, z = 100}, seed = 423, octaves = 3, persist = 0.7}
local lead_params = {
offset = 0,
scale = 1,
spread = {x = 100, y = 100, z = 100},
seed = 423,
octaves = 3,
persist = 0.7
}
local lead_threshold = 0.3
minetest.register_ore({
@ -119,14 +147,11 @@ minetest.register_ore({
-- Sulfur
local sulfur_buf = {}
local sulfur_noise= nil
local sulfur_noise
minetest.register_on_generated(function(minp, maxp, seed)
minetest.register_on_generated(function(minp, maxp)
local vm, emin, emax = minetest.get_mapgen_object("voxelmanip")
local a = VoxelArea:new{
MinEdge = {x = emin.x, y = emin.y, z = emin.z},
MaxEdge = {x = emax.x, y = emax.y, z = emax.z},
}
local a = VoxelArea:new({MinEdge=emin, MaxEdge=emax})
local data = vm:get_data(sulfur_buf)
local pr = PseudoRandom(17 * minp.x + 42 * minp.y + 101 * minp.z)
sulfur_noise = sulfur_noise or minetest.get_perlin(9876, 3, 0.5, 100)
@ -142,7 +167,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
for z = minp.z + math.floor(grid_size / 2), maxp.z, grid_size do
local c = data[a:index(x, y, z)]
if (c == c_lava or c == c_lava_flowing)
and sulfur_noise:get3d({x = x, y = z, z = z}) >= 0.4 then
and sulfur_noise:get_3d({x = x, y = z, z = z}) >= 0.4 then
for i in a:iter(
math.max(minp.x, x - grid_size),
math.max(minp.y, y - grid_size),
@ -176,7 +201,10 @@ minetest.register_ore({
y_min = -31000,
y_max = -50,
noise_threshold = 0.4,
noise_params = {offset=0, scale=15, spread={x=150, y=150, z=150}, seed=23, octaves=3, persist=0.70}
noise_params = {
offset = 0, scale = 15, spread = {x = 150, y = 150, z = 150},
seed = 23, octaves = 3, persist = 0.70
}
})
end
@ -191,7 +219,9 @@ minetest.register_ore({
y_min = -31000,
y_max = -150,
noise_threshold = 0.4,
noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70}
noise_params = {
offset = 0, scale = 15, spread = {x = 130, y = 130, z = 130},
seed = 24, octaves = 3, persist = 0.70
}
})
end