//move+ add comment about bug

This commit is contained in:
Starbeamrainbowlabs 2021-12-31 03:01:51 +00:00
parent 56a83572e7
commit 934007c07b
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -28,7 +28,6 @@ function worldeditadditions.move(source_pos1, source_pos2, target_pos1, target_p
local data_target = manip_target:get_data()
-- z y x is the preferred loop order (because CPU cache, since then we're iterating linearly through the data array backwards. This only holds true for little-endian machines however)
for z = source_pos2.z, source_pos1.z, -1 do
for y = source_pos2.y, source_pos1.y, -1 do
for x = source_pos2.x, source_pos1.x, -1 do
@ -37,14 +36,19 @@ function worldeditadditions.move(source_pos1, source_pos2, target_pos1, target_p
local target = source:subtract(offset)
local target_i = area_target:index(target.x, target.y, target.z)
data_target[target_i] = data_source[source_i]
data_source[source_i] = node_id_air
end
end
end
-- Save the modified nodes back to disk & return
-- Note that we save the source region *first* to avoid issues with overlap
-- BUG: Voxel Manipulators cover a larger area than the source area if the target position is too close the to the source, then the source will be overwritten by the target by accident.
worldedit.manip_helpers.finish(manip_source, data_source)
worldedit.manip_helpers.finish(manip_target, data_target)