emerge before geode and surface pool placement

otherwise they can be cut off
This commit is contained in:
cora 2022-07-01 14:43:03 +02:00
parent ef14006f15
commit 6ad00e4170
2 changed files with 86 additions and 78 deletions

View File

@ -17,50 +17,54 @@ local function makegeode(pos,def,pr)
local size = pr:next(5,7) local size = pr:next(5,7)
local p1 = vector.offset(pos,-size,-size,-size) local p1 = vector.offset(pos,-size,-size,-size)
local p2 = vector.offset(pos,size,size,size) local p2 = vector.offset(pos,size,size,size)
local calcite = {} minetest.emerge_area(p1, p2, function(blockpos, action, calls_remaining, param)
local nn = minetest.find_nodes_in_area(p1,p2,{"group:material_stone"}) if calls_remaining ~= 0 then return end
table.sort(nn,function(a, b) local calcite = {}
return vector.distance(pos, a) < vector.distance(pos, b) local nn = minetest.find_nodes_in_area(p1,p2,{"group:material_stone"})
end) table.sort(nn,function(a, b)
if not nn[1] then return end return vector.distance(pos, a) < vector.distance(pos, b)
end)
if not nn[1] then return end
for i=1,math.random(#nn) do for i=1,math.random(#nn) do
set_node_no_bedrock(nn[i],{name="mcl_amethyst:amethyst_block"}) set_node_no_bedrock(nn[i],{name="mcl_amethyst:amethyst_block"})
end end
for k,v in pairs(minetest.find_nodes_in_area(p1,p2,{"mcl_amethyst:amethyst_block"})) do for k,v in pairs(minetest.find_nodes_in_area(p1,p2,{"mcl_amethyst:amethyst_block"})) do
local all_amethyst = true local all_amethyst = true
for kk,vv in pairs(adjacents) do for kk,vv in pairs(adjacents) do
local pp = vector.add(v,vv) local pp = vector.add(v,vv)
local an = minetest.get_node(pp) local an = minetest.get_node(pp)
if an.name ~= "mcl_amethyst:amethyst_block" then if an.name ~= "mcl_amethyst:amethyst_block" then
if minetest.get_item_group(an.name,"material_stone") > 0 then if minetest.get_item_group(an.name,"material_stone") > 0 then
set_node_no_bedrock(pp,{name="mcl_amethyst:calcite"}) set_node_no_bedrock(pp,{name="mcl_amethyst:calcite"})
table.insert(calcite,pp) table.insert(calcite,pp)
if pr:next(1,5) == 1 then if pr:next(1,5) == 1 then
set_node_no_bedrock(v,{name="mcl_amethyst:budding_amethyst_block"}) set_node_no_bedrock(v,{name="mcl_amethyst:budding_amethyst_block"})
end
all_amethyst = false
elseif an.name ~= "mcl_amethyst:amethyst_block" and an.name ~= "air" then
all_amethyst = false
end end
all_amethyst = false
elseif an.name ~= "mcl_amethyst:amethyst_block" and an.name ~= "air" then
all_amethyst = false
end end
end end
if all_amethyst then set_node_no_bedrock(v,{name="air"}) end
end end
if all_amethyst then set_node_no_bedrock(v,{name="air"}) end
end
for _,v in pairs(calcite) do for _,v in pairs(calcite) do
for _,vv in pairs(minetest.find_nodes_in_area(vector.offset(v,-1,-1,-1),vector.offset(v,1,1,1),{"group:material_stone"})) do for _,vv in pairs(minetest.find_nodes_in_area(vector.offset(v,-1,-1,-1),vector.offset(v,1,1,1),{"group:material_stone"})) do
set_node_no_bedrock(vv,{name="mcl_blackstone:basalt_smooth"}) set_node_no_bedrock(vv,{name="mcl_blackstone:basalt_smooth"})
end
end end
end
for k,v in pairs(minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_amethyst:amethyst_block","mcl_amethyst:budding_amethyst_block"})) do for k,v in pairs(minetest.find_nodes_in_area_under_air(p1,p2,{"mcl_amethyst:amethyst_block","mcl_amethyst:budding_amethyst_block"})) do
local r = pr:next(1,50) local r = pr:next(1,50)
if r < 10 then if r < 10 then
set_node_no_bedrock(vector.offset(v,0,1,0),{name="mcl_amethyst:amethyst_cluster",param2=1}) set_node_no_bedrock(vector.offset(v,0,1,0),{name="mcl_amethyst:amethyst_cluster",param2=1})
end
end end
end return true
end)
return true return true
end end

View File

@ -33,51 +33,55 @@ local function makelake(pos,size,liquid,placein,border,pr)
local node_under = minetest.get_node(vector.offset(pos,0,-1,0)) local node_under = minetest.get_node(vector.offset(pos,0,-1,0))
local p1 = vector.offset(pos,-size,-1,-size) local p1 = vector.offset(pos,-size,-1,-size)
local p2 = vector.offset(pos,size,-1,size) local p2 = vector.offset(pos,size,-1,size)
local nn = minetest.find_nodes_in_area(p1,p2,placein) minetest.emerge_area(p1, p2, function(blockpos, action, calls_remaining, param)
table.sort(nn,function(a, b) if calls_remaining ~= 0 then return end
return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b) local nn = minetest.find_nodes_in_area(p1,p2,placein)
table.sort(nn,function(a, b)
return vector.distance(vector.new(pos.x,0,pos.z), a) < vector.distance(vector.new(pos.x,0,pos.z), b)
end)
if not nn[1] then return end
local y = pos.y - pr:next(1,2)
local lq = {}
local air = {}
local r = pr:next(1,#nn)
if r > #nn then return end
for i=1,r do
if nn[i].y == y then
airtower(nn[i],air,55)
table.insert(lq,nn[i])
end
end
minetest.bulk_set_node(lq,{name=liquid})
minetest.bulk_set_node(air,{name="air"})
air = {}
local br = {}
for k,v in pairs(lq) do
for kk,vv in pairs(adjacents) do
local pp = vector.add(v,vv)
local an = minetest.get_node(pp)
local un = minetest.get_node(vector.offset(pp,0,1,0))
if not border then
if minetest.get_item_group(an.name,"solid") > 0 then
border = an.name
elseif minetest.get_item_group(minetest.get_node(nn[1]).name,"solid") > 0 then
border = minetest.get_node_or_nil(nn[1]).name
else
border = "mcl_core:stone"
end
if border == nil or border == "mcl_core:dirt" then border = "mcl_core:dirt_with_grass" end
end
if an.name ~= liquid then
table.insert(br,pp)
if un.name ~= liquid then
airtower(pp,air,55)
end
end
end
end
minetest.bulk_set_node(br,{name=border})
minetest.bulk_set_node(air,{name="air"})
return true
end) end)
if not nn[1] then return end
local y = pos.y - pr:next(1,2)
local lq = {}
local air = {}
local r = pr:next(1,#nn)
if r > #nn then return end
for i=1,r do
if nn[i].y == y then
airtower(nn[i],air,55)
table.insert(lq,nn[i])
end
end
minetest.bulk_set_node(lq,{name=liquid})
minetest.bulk_set_node(air,{name="air"})
air = {}
local br = {}
for k,v in pairs(lq) do
for kk,vv in pairs(adjacents) do
local pp = vector.add(v,vv)
local an = minetest.get_node(pp)
local un = minetest.get_node(vector.offset(pp,0,1,0))
if not border then
if minetest.get_item_group(an.name,"solid") > 0 then
border = an.name
elseif minetest.get_item_group(minetest.get_node(nn[1]).name,"solid") > 0 then
border = minetest.get_node_or_nil(nn[1]).name
else
border = "mcl_core:stone"
end
if border == nil or border == "mcl_core:dirt" then border = "mcl_core:dirt_with_grass" end
end
if an.name ~= liquid then
table.insert(br,pp)
if un.name ~= liquid then
airtower(pp,air,55)
end
end
end
end
minetest.bulk_set_node(br,{name=border})
minetest.bulk_set_node(air,{name="air"})
return true return true
end end