summaryrefslogtreecommitdiff
path: root/worldedit_commands
diff options
context:
space:
mode:
authorAnthony Zhang <azhang9@gmail.com>2013-01-12 16:46:40 -0500
committerAnthony Zhang <azhang9@gmail.com>2013-01-12 16:46:40 -0500
commitc27ab877f1bc8afde76f9cfe11c7880cec9bdda2 (patch)
tree3a1206813ee47c1fdca03f962d7872952f5f53e2 /worldedit_commands
parent7cb2df24b8c8d9055adbff0825f27138f22a598a (diff)
New command: //orient, that rotates oriented nodes such as furnaces around the Y-axis by a specified angle.
Diffstat (limited to 'worldedit_commands')
-rw-r--r--worldedit_commands/init.lua27
1 files changed, 27 insertions, 0 deletions
diff --git a/worldedit_commands/init.lua b/worldedit_commands/init.lua
index b0e15b3..15220c6 100644
--- a/worldedit_commands/init.lua
+++ b/worldedit_commands/init.lua
@@ -544,6 +544,33 @@ minetest.register_chatcommand("/rotate", {
end,
})
+minetest.register_chatcommand("/orient", {
+ params = "<angle>",
+ description = "Rotate oriented nodes in the current WorldEdit region around the Y axis by angle <angle> (90 degree increment)",
+ privs = {worldedit=true},
+ func = function(name, param)
+ local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name]
+ if pos1 == nil or pos2 == nil then
+ minetest.chat_send_player(name, "No WorldEdit region selected")
+ return
+ end
+
+ local found, _, angle = param:find("^([+-]?%d+)$")
+ if found == nil then
+ minetest.chat_send_player(name, "Invalid usage: " .. param)
+ return
+ end
+ if angle % 90 ~= 0 then
+ minetest.chat_send_player(name, "Invalid usage: angle must be multiple of 90")
+ return
+ end
+
+ local count = worldedit.orient(pos1, pos2, angle)
+
+ minetest.chat_send_player(name, count .. " nodes oriented")
+ end,
+})
+
minetest.register_chatcommand("/fixlight", {
params = "",
description = "Fix the lighting in the current WorldEdit region",