forked from VoxeLibre/VoxeLibre
Fix surface pools with deep holes (#4571)
Sometimes, pools would spawn deep underground and then produce deep holes. I noticed that such pools would be at +48, at the block boundary. IMHO this may be an error in minetest surface detection. Nevertheless, here is a workaround: require air above pool spawns. Also clean up the pool code Reviewed-on: VoxeLibre/VoxeLibre#4571 Reviewed-by: Mikita Wiśniewski <rudzik8@protonmail.com> Co-authored-by: kno10 <erich.schubert@gmail.com> Co-committed-by: kno10 <erich.schubert@gmail.com>
This commit is contained in:
parent
38822aba0a
commit
dd4898b319
|
@ -30,26 +30,21 @@ local function airtower(pos,tbl,h)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function makelake(pos,size,liquid,placein,border,pr,noair)
|
local function makelake(pos,size,liquid,placein,border,pr,noair)
|
||||||
local node_under = minetest.get_node(vector.offset(pos,0,-1,0))
|
local p1, p2 = vector.offset(pos,-size,-1,-size), vector.offset(pos,size,-1,size)
|
||||||
local p1 = vector.offset(pos,-size,-1,-size)
|
local e1, e2 = vector.offset(pos,-size,-2,-size), vector.offset(pos,size,15,size)
|
||||||
local p2 = vector.offset(pos,size,-1,size)
|
minetest.emerge_area(e1, e2, function(blockpos, action, calls_remaining, param)
|
||||||
minetest.emerge_area(p1, p2, function(blockpos, action, calls_remaining, param)
|
|
||||||
if calls_remaining ~= 0 then return end
|
if calls_remaining ~= 0 then return end
|
||||||
local nn = minetest.find_nodes_in_area(p1,p2,placein)
|
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
|
if not nn[1] then return end
|
||||||
local y = pos.y - pr:next(1,2)
|
table.sort(nn,function(a, b)
|
||||||
local lq = {}
|
return vector.distance(pos, a) < vector.distance(pos, b)
|
||||||
local air = {}
|
end)
|
||||||
|
local y = pos.y - 1
|
||||||
|
local lq, air = {}, {}
|
||||||
local r = pr:next(1,#nn)
|
local r = pr:next(1,#nn)
|
||||||
if r > #nn then return end
|
|
||||||
for i=1,r do
|
for i=1,r do
|
||||||
if nn[i].y == y then
|
airtower(nn[i],air,20)
|
||||||
airtower(nn[i],air,55)
|
table.insert(lq,nn[i])
|
||||||
table.insert(lq,nn[i])
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
minetest.bulk_set_node(lq,{name=liquid})
|
minetest.bulk_set_node(lq,{name=liquid})
|
||||||
minetest.bulk_set_node(air,{name="air"})
|
minetest.bulk_set_node(air,{name="air"})
|
||||||
|
@ -59,7 +54,6 @@ local function makelake(pos,size,liquid,placein,border,pr,noair)
|
||||||
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)
|
||||||
local un = minetest.get_node(vector.offset(pp,0,1,0))
|
|
||||||
if not border then
|
if not border then
|
||||||
if minetest.get_item_group(an.name,"solid") > 0 then
|
if minetest.get_item_group(an.name,"solid") > 0 then
|
||||||
border = an.name
|
border = an.name
|
||||||
|
@ -72,9 +66,11 @@ local function makelake(pos,size,liquid,placein,border,pr,noair)
|
||||||
end
|
end
|
||||||
if not noair and an.name ~= liquid then
|
if not noair and an.name ~= liquid then
|
||||||
table.insert(br,pp)
|
table.insert(br,pp)
|
||||||
|
--[[ no need to have air above border:
|
||||||
|
local un = minetest.get_node(vector.offset(pp,0,1,0))
|
||||||
if un.name ~= liquid then
|
if un.name ~= liquid then
|
||||||
airtower(pp,air,55)
|
airtower(pp,air,20)
|
||||||
end
|
end]]--
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -181,7 +177,7 @@ mcl_structures.register_structure("lavapool",{
|
||||||
persist = 0.001,
|
persist = 0.001,
|
||||||
flags = "absvalue",
|
flags = "absvalue",
|
||||||
},
|
},
|
||||||
flags = "place_center_x, place_center_z, force_placement",
|
flags = "place_center_x, place_center_z, all_floors",
|
||||||
y_max = mcl_vars.mg_overworld_max,
|
y_max = mcl_vars.mg_overworld_max,
|
||||||
y_min = minetest.get_mapgen_setting("water_level"),
|
y_min = minetest.get_mapgen_setting("water_level"),
|
||||||
place_func = function(pos,def,pr)
|
place_func = function(pos,def,pr)
|
||||||
|
@ -201,7 +197,7 @@ mcl_structures.register_structure("water_lake",{
|
||||||
persist = 0.001,
|
persist = 0.001,
|
||||||
flags = "absvalue",
|
flags = "absvalue",
|
||||||
},
|
},
|
||||||
flags = "place_center_x, place_center_z, force_placement",
|
flags = "place_center_x, place_center_z, all_floors",
|
||||||
y_max = mcl_vars.mg_overworld_max,
|
y_max = mcl_vars.mg_overworld_max,
|
||||||
y_min = minetest.get_mapgen_setting("water_level"),
|
y_min = minetest.get_mapgen_setting("water_level"),
|
||||||
place_func = function(pos,def,pr)
|
place_func = function(pos,def,pr)
|
||||||
|
@ -222,7 +218,7 @@ mcl_structures.register_structure("water_lake_mangrove_swamp",{
|
||||||
persist = 0.001,
|
persist = 0.001,
|
||||||
flags = "absvalue",
|
flags = "absvalue",
|
||||||
},
|
},
|
||||||
flags = "place_center_x, place_center_z, force_placement",
|
flags = "place_center_x, place_center_z, all_floors",
|
||||||
y_max = mcl_vars.mg_overworld_max,
|
y_max = mcl_vars.mg_overworld_max,
|
||||||
y_min = minetest.get_mapgen_setting("water_level"),
|
y_min = minetest.get_mapgen_setting("water_level"),
|
||||||
place_func = function(pos,def,pr)
|
place_func = function(pos,def,pr)
|
||||||
|
@ -230,14 +226,6 @@ mcl_structures.register_structure("water_lake_mangrove_swamp",{
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
local pool_adjacents = {
|
|
||||||
vector.new(1,0,0),
|
|
||||||
vector.new(-1,0,0),
|
|
||||||
vector.new(0,-1,0),
|
|
||||||
vector.new(0,0,1),
|
|
||||||
vector.new(0,0,-1),
|
|
||||||
}
|
|
||||||
|
|
||||||
mcl_structures.register_structure("basalt_column",{
|
mcl_structures.register_structure("basalt_column",{
|
||||||
place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"},
|
place_on = {"mcl_blackstone:blackstone","mcl_blackstone:basalt"},
|
||||||
terrain_feature = true,
|
terrain_feature = true,
|
||||||
|
|
Loading…
Reference in New Issue