Skip to content

Commit

Permalink
//rotate: zero out param2 of source
Browse files Browse the repository at this point in the history
Actually copying over and hanlding param2 properly ref rotation will require //orient+ first
  • Loading branch information
sbrl committed Dec 19, 2023
1 parent c35631c commit edbb6db
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions worldeditadditions/lib/rotate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ function worldeditadditions.rotate(pos1, pos2, origin, rotlist)


--- 3: Check out a VoxelManipulator for the source and target regions
-- TODO support param2 here
-- TODO support param2 here. We zero out the source.... but don't carry over to the target. This probably requires //orient+ first.
local manip_src, area_src = worldedit.manip_helpers.init(pos1, pos2)
local data_src = manip_src:get_data()
local param2_src = manip_src:get_param2_data()

-- TODO: grab only an area at this point for dest and a blank target table. Then copy over to the real dest later to ensure consistency. This is important because we are dealing in (potentially) non-cardinal rectangles here
-- local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2})
Expand Down Expand Up @@ -88,12 +89,15 @@ function worldeditadditions.rotate(pos1, pos2, origin, rotlist)
for z = pos2.z, pos1.z, -1 do
for y = pos2.y, pos1.y, -1 do
for x = pos2.x, pos1.x, -1 do
data_src[area_src:index(x, y, z)] = id_air
local src_i = area_src:index(x, y, z)
data_src[src_i] = id_air
param2_src[src_i] = 0
end
end
end
manip_src:set_param2_data(param2_src)
worldedit.manip_helpers.finish(manip_src, data_src)
manip_src, area_src, data_src = nil, nil, nil
manip_src, area_src, data_src, param2_src = nil, nil, nil, nil


--- 6: Reinitialise the destination VoxelManip and copy data over
Expand Down

0 comments on commit edbb6db

Please sign in to comment.