From 3b9f1b867b6a427d587317da9c9e8a019f6cbb71 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 5 Apr 2021 00:57:40 +0200 Subject: [PATCH] Increase area cleaning size to full XZ extent --- init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index ec4d702..2253cdb 100644 --- a/init.lua +++ b/init.lua @@ -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