Add make_foundation option
test by /spawnstruct nether_outpost without being on complete (covering the sidelen) solid ground
This commit is contained in:
parent
d8697cb59c
commit
e37358d220
|
@ -16,6 +16,7 @@ mcl_structures.register_structure("nether_outpost",{
|
|||
biomes = {"Nether","SoulsandValley","WarpedForest","CrimsonForest","BasaltDelta"},
|
||||
sidelen = 15,
|
||||
solid_ground = true,
|
||||
make_foundation = true,
|
||||
y_min = mcl_vars.mg_lava_nether_max - 1,
|
||||
y_max = mcl_vars.mg_nether_max - 30,
|
||||
filenames = { modpath.."/schematics/nether_outpost.mts" },
|
||||
|
|
|
@ -11,16 +11,21 @@ function mcl_structures.place_structure(pos, def, pr)
|
|||
end
|
||||
if def.solid_ground and def.sidelen then
|
||||
local node = minetest.get_node(vector.offset(pos,1,1,0))
|
||||
local solid = minetest.find_nodes_in_area(vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2),vector.offset(pos,def.sidelen/2,-1,def.sidelen/2),{"group:solid"})
|
||||
local ground_p1 = vector.offset(pos,-def.sidelen/2,-1,-def.sidelen/2)
|
||||
local ground_p2 = vector.offset(pos,def.sidelen/2,-1,def.sidelen/2)
|
||||
local solid = minetest.find_nodes_in_area(ground_p1,ground_p2,{"group:solid"})
|
||||
local air = minetest.find_nodes_in_area(vector.offset(pos,-def.sidelen/2,1,-def.sidelen/2),vector.offset(pos,def.sidelen/2,4,def.sidelen/2),{"air"})
|
||||
if #solid < ( def.sidelen * def.sidelen ) or
|
||||
#air < (def.sidelen * def.sidelen ) then
|
||||
if logging then
|
||||
minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. No solid ground.")
|
||||
if def.make_foundation then
|
||||
minetest.bulk_set_node(minetest.find_nodes_in_area(ground_p1,vector.offset(ground_p2,0,-30,0),{"air"}),node)
|
||||
else
|
||||
if logging then
|
||||
minetest.log("warning","[mcl_structures] "..def.name.." at "..minetest.pos_to_string(pos).." not placed. No solid ground.")
|
||||
end
|
||||
return false
|
||||
end
|
||||
return false
|
||||
end
|
||||
--minetest.bulk_set_node(solid,node)
|
||||
end
|
||||
if def.on_place and not def.on_place(pos,def,pr) then
|
||||
if logging then
|
||||
|
|
Loading…
Reference in New Issue