forked from minetest-mods/technic
New ores code
This commit is contained in:
parent
52138943ee
commit
edd6f8c7e9
115
technic/ores.lua
115
technic/ores.lua
@ -248,54 +248,67 @@ minetest.register_craft({
|
|||||||
recipe = "technic:zinc_lump"
|
recipe = "technic:zinc_lump"
|
||||||
})
|
})
|
||||||
|
|
||||||
|
minetest.register_ore({
|
||||||
local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, ore_per_chunk, height_min, height_max)
|
ore_type = "scatter",
|
||||||
if maxp.y < height_min or minp.y > height_max then
|
ore = "technic:mineral_diamond",
|
||||||
return
|
wherein = "default:stone",
|
||||||
end
|
clust_scarcity = 11*11*11,
|
||||||
local y_min = math.max(minp.y, height_min)
|
clust_num_ores = 4,
|
||||||
local y_max = math.min(maxp.y, height_max)
|
clust_size = 3,
|
||||||
local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1)
|
height_min = -31000,
|
||||||
local pr = PseudoRandom(seed)
|
height_max = -450,
|
||||||
local num_chunks = math.floor(chunks_per_volume * volume)
|
})
|
||||||
local chunk_size = 3
|
minetest.register_ore({
|
||||||
if ore_per_chunk <= 4 then
|
ore_type = "scatter",
|
||||||
chunk_size = 2
|
ore = "technic:mineral_uranium",
|
||||||
end
|
wherein = "default:stone",
|
||||||
local inverse_chance = math.floor(chunk_size*chunk_size*chunk_size / ore_per_chunk)
|
clust_scarcity = 10*10*10,
|
||||||
--print("generate_ore num_chunks: "..dump(num_chunks))
|
clust_num_ores = 4,
|
||||||
for i=1,num_chunks do
|
clust_size = 3,
|
||||||
if (y_max-chunk_size+1 <= y_min) then return end
|
height_min = -300,
|
||||||
local y0 = pr:next(y_min, y_max-chunk_size+1)
|
height_max = -80,
|
||||||
if y0 >= height_min and y0 <= height_max then
|
})
|
||||||
local x0 = pr:next(minp.x, maxp.x-chunk_size+1)
|
minetest.register_ore({
|
||||||
local z0 = pr:next(minp.z, maxp.z-chunk_size+1)
|
ore_type = "scatter",
|
||||||
local p0 = {x=x0, y=y0, z=z0}
|
ore = "technic:mineral_chromium",
|
||||||
for x1=0,chunk_size-1 do
|
wherein = "default:stone",
|
||||||
for y1=0,chunk_size-1 do
|
clust_scarcity = 10*10*10,
|
||||||
for z1=0,chunk_size-1 do
|
clust_num_ores = 2,
|
||||||
if pr:next(1,inverse_chance) == 1 then
|
clust_size = 3,
|
||||||
local x2 = x0+x1
|
height_min = -31000,
|
||||||
local y2 = y0+y1
|
height_max = -100,
|
||||||
local z2 = z0+z1
|
})
|
||||||
local p2 = {x=x2, y=y2, z=z2}
|
minetest.register_ore({
|
||||||
if minetest.env:get_node(p2).name == wherein then
|
ore_type = "scatter",
|
||||||
minetest.env:set_node(p2, {name=name})
|
ore = "technic:mineral_zinc",
|
||||||
end
|
wherein = "default:stone",
|
||||||
end
|
clust_scarcity = 9*9*9,
|
||||||
end
|
clust_num_ores = 4,
|
||||||
end
|
clust_size = 3,
|
||||||
end
|
height_min = -31000,
|
||||||
end
|
height_max = 2,
|
||||||
end
|
})
|
||||||
--print("generate_ore done")
|
minetest.register_ore({
|
||||||
end
|
ore_type = "sheet",
|
||||||
|
ore = "technic:marble",
|
||||||
minetest.register_on_generated(function(minp, maxp, seed)
|
wherein = "default:stone",
|
||||||
generate_ore("technic:mineral_diamond", "default:stone", minp, maxp, seed+21, 1/11/11/11, 4, -31000, -450)
|
clust_scarcity = 1,
|
||||||
generate_ore("technic:mineral_uranium", "default:stone", minp, maxp, seed+22, 1/10/10/10, 3, -300, -80)
|
clust_num_ores = 1,
|
||||||
generate_ore("technic:mineral_chromium", "default:stone", minp, maxp, seed+23, 1/10/10/10, 2, -31000, -100)
|
clust_size = 3,
|
||||||
generate_ore("technic:mineral_zinc", "default:stone", minp, maxp, seed+24, 1/9/9/9, 4, -31000, 2)
|
height_min = -150,
|
||||||
generate_ore("technic:marble", "default:stone", minp, maxp, seed+25, 1/128, 20, -100, -32)
|
height_max = -50,
|
||||||
generate_ore("technic:granite", "default:stone", minp, maxp, seed+25, 1/128, 15, -190, -90)
|
noise_threshhold = 0.5,
|
||||||
end)
|
noise_params = {offset=0, scale=15, spread={x=150, y=150, z=150}, seed=23, octaves=3, persist=0.70}
|
||||||
|
})
|
||||||
|
minetest.register_ore({
|
||||||
|
ore_type = "sheet",
|
||||||
|
ore = "technic:granite",
|
||||||
|
wherein = "default:stone",
|
||||||
|
clust_scarcity = 1,
|
||||||
|
clust_num_ores = 1,
|
||||||
|
clust_size = 4,
|
||||||
|
height_min = -100,
|
||||||
|
height_max = -250,
|
||||||
|
noise_threshhold = 0.5,
|
||||||
|
noise_params = {offset=0, scale=15, spread={x=130, y=130, z=130}, seed=24, octaves=3, persist=0.70}
|
||||||
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user