diff options
author | Kyle <kyle.kylina@gmail.com> | 2012-08-28 15:57:45 -0700 |
---|---|---|
committer | Kyle <kyle.kylina@gmail.com> | 2012-08-28 15:57:45 -0700 |
commit | 6eb08edd3005518f06c6c43f324399d8bed6a830 (patch) | |
tree | 5ecd438299b321b5505e0725df6c3fadb77b876f /init.lua | |
parent | 91c24d3a609bc1e22f132f6c8a9e9b86f0850fa5 (diff) |
Rotate now works with x/y/z/? instead of just y: "//rotate x 90"
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -404,8 +404,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]
@@ -414,17 +414,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,
})
|