Increase area cleaning size to full XZ extent

This commit is contained in:
Wuzzy 2021-04-05 00:57:40 +02:00
parent 98b3ae87ea
commit 3b9f1b867b
1 changed files with 5 additions and 2 deletions

View File

@ -1329,10 +1329,13 @@ minetest.register_chatcommand("placeschem", {
local schematic = minetest.read_schematic(schem_path, {})
if schematic then
if clear then
-- Clear same size for X and Z because
-- because schematic is randomly rotated
local max_xz = math.max(schematic.size.x, schematic.size.z)
local posses = {}
for z=pos.z, pos.z+schematic.size.z-1 do
for z=pos.z, pos.z+max_xz-1 do
for y=pos.y, pos.y+schematic.size.y-1 do
for x=pos.x, pos.x+schematic.size.x-1 do
for x=pos.x, pos.x+max_xz-1 do
table.insert(posses, {x=x,y=y,z=z})
end
end