From e37358d220efaeece70833694f81d95090596dcc Mon Sep 17 00:00:00 2001 From: cora Date: Thu, 23 Jun 2022 20:22:36 +0200 Subject: [PATCH] Add make_foundation option test by /spawnstruct nether_outpost without being on complete (covering the sidelen) solid ground --- mods/MAPGEN/mcl_nether_fortresses/init.lua | 1 + mods/MAPGEN/mcl_structures/api.lua | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/mods/MAPGEN/mcl_nether_fortresses/init.lua b/mods/MAPGEN/mcl_nether_fortresses/init.lua index 16fd11fb1d..8a5d972440 100644 --- a/mods/MAPGEN/mcl_nether_fortresses/init.lua +++ b/mods/MAPGEN/mcl_nether_fortresses/init.lua @@ -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" }, diff --git a/mods/MAPGEN/mcl_structures/api.lua b/mods/MAPGEN/mcl_structures/api.lua index 5153e85f98..c0167060b2 100644 --- a/mods/MAPGEN/mcl_structures/api.lua +++ b/mods/MAPGEN/mcl_structures/api.lua @@ -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