mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-22 10:31:06 +01:00
emerge before geode and surface pool placement
otherwise they can be cut off
This commit is contained in:
parent
ef14006f15
commit
6ad00e4170
2 changed files with 86 additions and 78 deletions
|
@ -17,50 +17,54 @@ local function makegeode(pos,def,pr)
|
|||
local size = pr:next(5,7)
|
||||
local p1 = vector.offset(pos,-size,-size,-size)
|
||||
local p2 = vector.offset(pos,size,size,size)
|
||||
local calcite = {}
|
||||
local nn = minetest.find_nodes_in_area(p1,p2,{"group:material_stone"})
|
||||
table.sort(nn,function(a, b)
|
||||
return vector.distance(pos, a) < vector.distance(pos, b)
|
||||
end)
|
||||
if not nn[1] then return end
|
||||
minetest.emerge_area(p1, p2, function(blockpos, action, calls_remaining, param)
|
||||
if calls_remaining ~= 0 then return end
|
||||
local calcite = {}
|
||||
local nn = minetest.find_nodes_in_area(p1,p2,{"group:material_stone"})
|
||||
table.sort(nn,function(a, b)
|
||||
return vector.distance(pos, a) < vector.distance(pos, b)
|
||||
end)
|
||||
if not nn[1] then return end
|
||||
|
||||
for i=1,math.random(#nn) do
|
||||
set_node_no_bedrock(nn[i],{name="mcl_amethyst:amethyst_block"})
|
||||
end
|
||||
for i=1,math.random(#nn) do
|
||||
set_node_no_bedrock(nn[i],{name="mcl_amethyst:amethyst_block"})
|
||||
end
|
||||
|
||||
for k,v in pairs(minetest.find_nodes_in_area(p1,p2,{"mcl_amethyst:amethyst_block"})) do
|
||||
local all_amethyst = true
|
||||
for kk,vv in pairs(adjacents) do
|
||||
local pp = vector.add(v,vv)
|
||||
local an = minetest.get_node(pp)
|
||||
if an.name ~= "mcl_amethyst:amethyst_block" then
|
||||
if minetest.get_item_group(an.name,"material_stone") > 0 then
|
||||
set_node_no_bedrock(pp,{name="mcl_amethyst:calcite"})
|
||||
table.insert(calcite,pp)
|
||||
if pr:next(1,5) == 1 then
|
||||
set_node_no_bedrock(v,{name="mcl_amethyst:budding_amethyst_block"})
|
||||
for k,v in pairs(minetest.find_nodes_in_area(p1,p2,{"mcl_amethyst:amethyst_block"})) do
|
||||
local all_amethyst = true
|
||||
for kk,vv in pairs(adjacents) do
|
||||
local pp = vector.add(v,vv)
|
||||
local an = minetest.get_node(pp)
|
||||
if an.name ~= "mcl_amethyst:amethyst_block" then
|
||||
if minetest.get_item_group(an.name,"material_stone") > 0 then
|
||||
set_node_no_bedrock(pp,{name="mcl_amethyst:calcite"})
|
||||
table.insert(calcite,pp)
|
||||
if pr:next(1,5) == 1 then
|
||||
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
|
||||
all_amethyst = false
|
||||
elseif an.name ~= "mcl_amethyst:amethyst_block" and an.name ~= "air" then
|
||||
all_amethyst = false
|
||||
end
|
||||
end
|
||||
if all_amethyst then set_node_no_bedrock(v,{name="air"}) end
|
||||
end
|
||||
if all_amethyst then set_node_no_bedrock(v,{name="air"}) end
|
||||
end
|
||||
|
||||
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
|
||||
set_node_no_bedrock(vv,{name="mcl_blackstone:basalt_smooth"})
|
||||
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
|
||||
set_node_no_bedrock(vv,{name="mcl_blackstone:basalt_smooth"})
|
||||
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
|
||||
local r = pr:next(1,50)
|
||||
if r < 10 then
|
||||
set_node_no_bedrock(vector.offset(v,0,1,0),{name="mcl_amethyst:amethyst_cluster",param2=1})
|
||||
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)
|
||||
if r < 10 then
|
||||
set_node_no_bedrock(vector.offset(v,0,1,0),{name="mcl_amethyst:amethyst_cluster",param2=1})
|
||||
end
|
||||
end
|
||||
end
|
||||
return true
|
||||
end)
|
||||
return true
|
||||
end
|
||||
|
||||
|
|
|
@ -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 p1 = vector.offset(pos,-size,-1,-size)
|
||||
local p2 = vector.offset(pos,size,-1,size)
|
||||
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)
|
||||
minetest.emerge_area(p1, p2, function(blockpos, action, calls_remaining, param)
|
||||
if calls_remaining ~= 0 then return end
|
||||
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)
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue