From c27ab877f1bc8afde76f9cfe11c7880cec9bdda2 Mon Sep 17 00:00:00 2001 From: Anthony Zhang Date: Sat, 12 Jan 2013 16:46:40 -0500 Subject: New command: //orient, that rotates oriented nodes such as furnaces around the Y-axis by a specified angle. --- worldedit_commands/init.lua | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'worldedit_commands') 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 = "", + description = "Rotate oriented nodes in the current WorldEdit region around the Y axis by 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", -- cgit v1.2.3