mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-10-31 21:33:02 +00:00
//copy+: respect param2
This commit is contained in:
parent
5c632df658
commit
d63400e697
1 changed files with 4 additions and 0 deletions
|
@ -27,10 +27,12 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p
|
||||||
-- Fetch the nodes in the source area
|
-- Fetch the nodes in the source area
|
||||||
local manip_source, area_source = worldedit.manip_helpers.init(source_pos1, source_pos2)
|
local manip_source, area_source = worldedit.manip_helpers.init(source_pos1, source_pos2)
|
||||||
local data_source = manip_source:get_data()
|
local data_source = manip_source:get_data()
|
||||||
|
local data_source_param2 = manip_source:get_param2_data()
|
||||||
|
|
||||||
-- Fetch a manip for the target area
|
-- Fetch a manip for the target area
|
||||||
local manip_target, area_target = worldedit.manip_helpers.init(target_pos1, target_pos2)
|
local manip_target, area_target = worldedit.manip_helpers.init(target_pos1, target_pos2)
|
||||||
local data_target = manip_target:get_data()
|
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)
|
-- 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
|
local total_replaced = 0
|
||||||
|
@ -48,6 +50,7 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p
|
||||||
end
|
end
|
||||||
if should_replace then
|
if should_replace then
|
||||||
data_target[target_i] = data_source[source_i]
|
data_target[target_i] = data_source[source_i]
|
||||||
|
data_target_param2[target_i] = data_source_param2[source_i]
|
||||||
total_replaced = total_replaced + 1
|
total_replaced = total_replaced + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -55,6 +58,7 @@ function worldeditadditions.copy(source_pos1, source_pos2, target_pos1, target_p
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Save the modified nodes back to disk & return
|
-- Save the modified nodes back to disk & return
|
||||||
|
manip_target:set_param2_data(data_target_param2)
|
||||||
worldedit.manip_helpers.finish(manip_target, data_target)
|
worldedit.manip_helpers.finish(manip_target, data_target)
|
||||||
|
|
||||||
return true, total_replaced
|
return true, total_replaced
|
||||||
|
|
Loading…
Reference in a new issue