mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-12-25 21:05:01 +00:00
//move+ add comment about bug
This commit is contained in:
parent
56a83572e7
commit
934007c07b
1 changed files with 5 additions and 1 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue