//revolve: don't rotate air nodes

this is important because when rotating multiple times it can easily overwrite parts of the structure with pointless air nodes where it shouldn't do
This commit is contained in:
Starbeamrainbowlabs 2023-02-12 02:08:44 +00:00
parent e942e4fb2f
commit cf8406b80f
No known key found for this signature in database
GPG Key ID: 1BE5172E637709C2

@ -46,22 +46,26 @@ function worldeditadditions.revolve(pos1, pos2, origin, times)
for z = pos2_source.z, pos1_source.z, -1 do for z = pos2_source.z, pos1_source.z, -1 do
for y = pos2_source.y, pos1_source.y, -1 do for y = pos2_source.y, pos1_source.y, -1 do
for x = pos2_source.x, pos1_source.x, -1 do for x = pos2_source.x, pos1_source.x, -1 do
for index, rotation in ipairs(rotation_radians) do local pos_source = Vector3.new(x, y, z)
local pos_source = Vector3.new(x, y, z) local i_source = area_source:index(x, y, z)
local pos_target = Vector3.rotate3d(
origin, -- Lua really sucks sometimes... a continue statement would be v useful here
pos_source, if not wea_c.is_airlike(data_source[i_source]) then
-- rotate on Z axis only, convert 0..1 → radians for index, rotation in ipairs(rotation_radians) do
-- TEST on Y axis, 'cause I'm confused local pos_target = Vector3.rotate3d(
Vector3.new(0, rotation * math.pi * 2, 0) origin,
):floor() pos_source,
-- rotate on Z axis only, convert 0..1 → radians
local i_source = area_source:index(x, y, z) -- TEST on Y axis, 'cause I'm confused
local i_target = area_target:index(pos_target.x, pos_target.y, pos_target.z) Vector3.new(0, rotation * math.pi * 2, 0)
):floor()
-- TODO: Rotate notes as appropriate
data_target[i_target] = data_source[i_source] local i_target = area_target:index(pos_target.x, pos_target.y, pos_target.z)
changed = changed + 1
-- TODO: Rotate notes as appropriate
data_target[i_target] = data_source[i_source]
changed = changed + 1
end
end end
end end
end end