//copy+: respect param2

This commit is contained in:
Starbeamrainbowlabs 2023-07-10 21:02:03 +01:00
parent 5c632df658
commit d63400e697
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
1 changed files with 4 additions and 0 deletions

View File

@ -27,10 +27,12 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p
-- Fetch the nodes in the source area
local manip_source, area_source = worldedit.manip_helpers.init(source_pos1, source_pos2)
local data_source = manip_source:get_data()
local data_source_param2 = manip_source:get_param2_data()
-- Fetch a manip for the target area
local manip_target, area_target = worldedit.manip_helpers.init(target_pos1, target_pos2)
local data_target = manip_target:get_data()
local data_target_param2 = manip_target:get_param2_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)
local total_replaced = 0
@ -48,6 +50,7 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p
end
if should_replace then
data_target[target_i] = data_source[source_i]
data_target_param2[target_i] = data_source_param2[source_i]
total_replaced = total_replaced + 1
end
end
@ -55,6 +58,7 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p
end
-- Save the modified nodes back to disk & return
manip_target:set_param2_data(data_target_param2)
worldedit.manip_helpers.finish(manip_target, data_target)
return true, total_replaced