summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorAnthony <azhang9@gmail.com>2012-08-30 21:38:00 -0700
committerAnthony <azhang9@gmail.com>2012-08-30 21:38:00 -0700
commita25a2a1fb0c198ca427a4da6ba53fd51b344ee54 (patch)
tree422533bd44a4d533ef97afeb2cb3f967b4c4853d /init.lua
parent340416c789fc8a2e32ae39c28b0ea6eea403bb4d (diff)
parent6eb08edd3005518f06c6c43f324399d8bed6a830 (diff)
Merge pull request #5 from khonkhortisan/master
Understands meta!
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/init.lua b/init.lua
index 1c3d323..dcac756 100644
--- a/init.lua
+++ b/init.lua
@@ -410,8 +410,8 @@ minetest.register_chatcommand("/flip", {
})
minetest.register_chatcommand("/rotate", {
- params = "<angle>",
- description = "Rotate the current WorldEdit region around the y axis by angle <angle> (90 degree increment)",
+ params = "<axis> <angle>",
+ description = "Rotate the current WorldEdit region around the axis <axis> by angle <angle> (90 degree increment)",
privs = {worldedit=true},
func = function(name, param)
local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
@@ -420,17 +420,20 @@ minetest.register_chatcommand("/rotate", {
return
end
- angle = tonumber(param)
- if angle == nil then
+ local found, _, axis, angle = param:find("^([xyz%?])%s+([+-]?%d+)$")
+ if found == nil then
minetest.chat_send_player(name, "Invalid usage: " .. param)
return
end
+ if axis == "?" then
+ axis = worldedit.player_axis(name)
+ end
if angle % 90 ~= 0 then
minetest.chat_send_player(name, "Invalid usage: angle must be multiple of 90")
return
end
- local count = worldedit.rotate(pos1, pos2, angle)
+ local count = worldedit.rotate(pos1, pos2, axis, angle)
minetest.chat_send_player(name, count .. " nodes rotated")
end,
})