mirror of
https://github.com/Uberi/Minetest-WorldEdit.git
synced 2024-12-26 10:40:40 +01:00
Merge pull request #11 from khonkhortisan/master
Allow multiple //moves
This commit is contained in:
commit
8102eb982e
@ -129,7 +129,7 @@ Copy the current WorldEdit region along the x/y/z/? axis by <amount> nodes.
|
|||||||
|
|
||||||
### //move x/y/z/? <amount>
|
### //move x/y/z/? <amount>
|
||||||
|
|
||||||
Move the current WorldEdit region along the x/y/z/? axis by <amount> nodes.
|
Move the current WorldEdit positions and region along the x/y/z/? axis by <amount> nodes.
|
||||||
|
|
||||||
//move x 15
|
//move x 15
|
||||||
//move y -7
|
//move y -7
|
||||||
|
@ -309,7 +309,7 @@ worldedit.copy = function(pos1, pos2, axis, amount)
|
|||||||
return worldedit.volume(pos1, pos2)
|
return worldedit.volume(pos1, pos2)
|
||||||
end
|
end
|
||||||
|
|
||||||
--moves the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") by `amount` nodes, returning the number of nodes moved
|
--moves positions `pos1` and `pos2` and the region defined by them along the `axis` axis ("x" or "y" or "z") by `amount` nodes, returning the number of nodes moved
|
||||||
worldedit.move = function(pos1, pos2, axis, amount)
|
worldedit.move = function(pos1, pos2, axis, amount)
|
||||||
local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
|
local pos1, pos2 = worldedit.sort_pos(pos1, pos2)
|
||||||
local env = minetest.env
|
local env = minetest.env
|
||||||
|
6
init.lua
6
init.lua
@ -323,6 +323,12 @@ minetest.register_chatcommand("/move", {
|
|||||||
end
|
end
|
||||||
|
|
||||||
local count = worldedit.move(pos1, pos2, axis, tonumber(amount))
|
local count = worldedit.move(pos1, pos2, axis, tonumber(amount))
|
||||||
|
|
||||||
|
worldedit.pos1[name][axis] = worldedit.pos1[name][axis] + amount
|
||||||
|
worldedit.pos2[name][axis] = worldedit.pos2[name][axis] + amount
|
||||||
|
worldedit.mark_pos1(name)
|
||||||
|
worldedit.mark_pos2(name)
|
||||||
|
|
||||||
minetest.chat_send_player(name, count .. " nodes moved")
|
minetest.chat_send_player(name, count .. " nodes moved")
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user