scale_down: fix a number of runtime errors

Note that we still haven't tested it :P
This commit is contained in:
Starbeamrainbowlabs 2021-02-17 23:09:25 +00:00
parent 0d5e71eb4f
commit 756c1c12f2
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
1 changed files with 2 additions and 3 deletions

View File

@ -27,15 +27,14 @@ function worldeditadditions.scale_down(pos1, pos2, scale, direction)
print("[DEBUG] scale_down", worldeditadditions.vector.tostring(scale_down))
local size = vector.subtract(pos2, pos1)
local manip, area = worldedit.manip_helpers.init(pos1, pos2)
local data = manip:get_data()
local data_copy = worldeditadditions.shallowcopy(data)
local node_id_air = minetest.get_content_id("air")
local count = 0 -- The number of nodes replaced
local stats = { updated = 0, scale = scale_down }
local stats = { updated = 0, scale = "scale_down" }
-- Zero out the area we're scaling down into
for i in area:iterp(pos1, pos2) do
data_copy[i] = node_id_air