mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-06 00:01:05 +01:00
Spawn clay as ore
This commit is contained in:
parent
d2bf912f94
commit
ad8c548473
2 changed files with 22 additions and 63 deletions
|
@ -10,6 +10,28 @@ local mountains = {
|
|||
"ExtremeHillsM", "ExtremeHillsM_ocean", "ExtremeHillsM_deep_ocean", "ExtremeHillsM_underground",
|
||||
}
|
||||
|
||||
--Clay
|
||||
minetest.register_ore({
|
||||
ore_type = "blob",
|
||||
ore = node,
|
||||
wherein = {"mcl_core:sand","mcl_core:stone","mcl_core:gravel"},
|
||||
clust_scarcity = 15*15*15,
|
||||
clust_num_ores = 33,
|
||||
clust_size = 5,
|
||||
y_min = -5,
|
||||
y_max = 0,
|
||||
noise_params = {
|
||||
offset = 0,
|
||||
scale = 1,
|
||||
spread = {x=250, y=250, z=250},
|
||||
seed = 3245123,
|
||||
octaves = 3,
|
||||
persist = 0.6,
|
||||
lacunarity = 2,
|
||||
flags = "defaults",
|
||||
}
|
||||
})
|
||||
|
||||
-- Diorite, andesite and granite
|
||||
local specialstones = { "mcl_core:diorite", "mcl_core:andesite", "mcl_core:granite" }
|
||||
for s=1, #specialstones do
|
||||
|
|
|
@ -53,63 +53,6 @@ local function xz_to_biomemap_index(x, z, minp, maxp)
|
|||
return (minix + miniz * zwidth) + 1
|
||||
end
|
||||
|
||||
-- Perlin noise objects
|
||||
local perlin_structures
|
||||
local perlin_vines, perlin_vines_fine, perlin_vines_upwards, perlin_vines_length, perlin_vines_density
|
||||
local perlin_clay
|
||||
|
||||
local function generate_clay(minp, maxp, blockseed, voxelmanip_data, voxelmanip_area, lvm_used)
|
||||
-- TODO: Make clay generation reproducible for same seed.
|
||||
if maxp.y < -5 or minp.y > 0 then
|
||||
return lvm_used
|
||||
end
|
||||
|
||||
local pr = PseudoRandom(blockseed)
|
||||
|
||||
perlin_clay = perlin_clay or minetest.get_perlin({
|
||||
offset = 0.5,
|
||||
scale = 0.2,
|
||||
spread = {x = 5, y = 5, z = 5},
|
||||
seed = -316,
|
||||
octaves = 1,
|
||||
persist = 0.0
|
||||
})
|
||||
|
||||
for y=math.max(minp.y, 0), math.min(maxp.y, -8), -1 do
|
||||
-- Assume X and Z lengths are equal
|
||||
local divlen = 4
|
||||
local divs = (maxp.x-minp.x)/divlen+1;
|
||||
for divx=0+1,divs-2 do
|
||||
for divz=0+1,divs-2 do
|
||||
-- Get position and shift it a bit randomly so the clay do not obviously appear in a grid
|
||||
local cx = minp.x + math.floor((divx+0.5)*divlen) + pr:next(-1,1)
|
||||
local cz = minp.z + math.floor((divz+0.5)*divlen) + pr:next(-1,1)
|
||||
|
||||
local water_pos = voxelmanip_area:index(cx, y+1, cz)
|
||||
local waternode = voxelmanip_data[water_pos]
|
||||
local surface_pos = voxelmanip_area:index(cx, y, cz)
|
||||
local surfacenode = voxelmanip_data[surface_pos]
|
||||
|
||||
local genrnd = pr:next(1, 20)
|
||||
if genrnd == 1 and perlin_clay:get_3d({x=cx,y=y,z=cz}) > 0 and waternode == c_water and
|
||||
(surfacenode == c_dirt or minetest.get_item_group(minetest.get_name_from_content_id(surfacenode), "sand") == 1) then
|
||||
local diamondsize = pr:next(1, 3)
|
||||
for x1 = -diamondsize, diamondsize do
|
||||
for z1 = -(diamondsize - math.abs(x1)), diamondsize - math.abs(x1) do
|
||||
local ccpos = voxelmanip_area:index(cx+x1, y, cz+z1)
|
||||
local claycandidate = voxelmanip_data[ccpos]
|
||||
if voxelmanip_data[ccpos] == c_dirt or minetest.get_item_group(minetest.get_name_from_content_id(claycandidate), "sand") == 1 then
|
||||
voxelmanip_data[ccpos] = c_clay
|
||||
lvm_used = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return lvm_used
|
||||
end
|
||||
|
||||
local function generate_end_exit_portal(pos)
|
||||
local obj = minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon")
|
||||
|
@ -239,12 +182,6 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
|
|||
lvm_used = set_layers(data, area, c_lava, c_air, mcl_vars.mg_overworld_min, mcl_vars.mg_lava_overworld_max, minp, maxp, lvm_used, pr)
|
||||
lvm_used = set_layers(data, area, c_nether_lava, c_air, mcl_vars.mg_nether_min, mcl_vars.mg_lava_nether_max, minp, maxp, lvm_used, pr)
|
||||
end
|
||||
|
||||
-- Clay, vines, cocoas
|
||||
lvm_used = generate_clay(minp, maxp, blockseed, data, area, lvm_used)
|
||||
biomemap = minetest.get_mapgen_object("biomemap")
|
||||
|
||||
|
||||
----- Interactive block fixing section -----
|
||||
----- The section to perform basic block overrides of the core mapgen generated world. -----
|
||||
|
||||
|
|
Loading…
Reference in a new issue