mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-23 23:53:44 +01:00
//move+: bugfix
This commit is contained in:
parent
8ec89c3e67
commit
607f2bfdea
@ -37,8 +37,8 @@ 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_source[source_i] = node_id_air
|
||||
data_target[target_i] = data_source[source_i]
|
||||
data_source[source_i] = node_id_air
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -45,18 +45,28 @@ worldedit.register_command("move+", { -- TODO: Make this an override
|
||||
local success_a, copy_offset = parse_stage2(name, parts)
|
||||
if not success_a then return success_a, copy_offset end
|
||||
|
||||
--- 1: Calculate the source & target regions
|
||||
-----------------------------------------------------------------------
|
||||
local source_pos1 = Vector3.clone(worldedit.pos1[name])
|
||||
local source_pos2 = Vector3.clone(worldedit.pos2[name])
|
||||
|
||||
local target_pos1 = source_pos1 + copy_offset
|
||||
local target_pos2 = source_pos2 + copy_offset
|
||||
|
||||
-- 2: Move the nodes
|
||||
-----------------------------------------------------------------------
|
||||
local success_b, nodes_modified = wea.move(
|
||||
source_pos1, source_pos2,
|
||||
target_pos1, target_pos2
|
||||
)
|
||||
if not success_b then return success_b, nodes_modified end
|
||||
|
||||
-- 3: Update the defined region
|
||||
-----------------------------------------------------------------------
|
||||
worldedit.pos1[name] = target_pos1
|
||||
worldedit.pos2[name] = target_pos2
|
||||
worldedit.marker_update(name)
|
||||
|
||||
local time_taken = wea.get_ms_time() - start_time
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user