]> git.lizzy.rs Git - worldedit.git/blobdiff - init.lua
Remove unused Code
[worldedit.git] / init.lua
index 10d03b8fe12ab9fbb4b793c6358eb1852b3e8731..7bd79beaeeafb2a83f2cbd722662c60f4083eb6f 100644 (file)
--- a/init.lua
+++ b/init.lua
@@ -216,6 +216,33 @@ minetest.register_chatcommand("/hollowcylinder", {
        end,\r
 })\r
 \r
+\r
+minetest.register_chatcommand("/spiral", {\r
+       params = "<size> <node>",\r
+       description = "Add Spiral at WorldEdit position 1 with size <size>, composed of <node>",\r
+       privs = {worldedit=true},\r
+       func = function(name, param)\r
+               local pos = worldedit.pos1[name]\r
+               if pos == nil then\r
+                       minetest.chat_send_player(name, "No WorldEdit region selected")\r
+                       return\r
+               end\r
+\r
+               local found, _, size, nodename = param:find("(%d+)%s+([^%s]+)$")\r
+               if found == nil then\r
+                       minetest.chat_send_player(name, "Invalid usage: " .. param)\r
+                       return\r
+               end\r
+               if not worldedit.node_is_valid(pos, nodename) then\r
+                       minetest.chat_send_player(name, "Invalid node name: " .. param)\r
+                       return\r
+               end\r
+\r
+               local count = worldedit.spiral(pos, tonumber(size), nodename)\r
+               minetest.chat_send_player(name, count .. " nodes changed")\r
+       end,\r
+})\r
+\r
 minetest.register_chatcommand("/cylinder", {\r
        params = "x/y/z/? <length> <radius> <node>",\r
        description = "Add cylinder at WorldEdit position 1 along the x/y/z/? axis with length <length> and radius <radius>, composed of <node>",\r
@@ -486,4 +513,4 @@ minetest.register_chatcommand("/load", {
 \r
                minetest.chat_send_player(name, count .. " nodes loaded")\r
        end,\r
-})
\ No newline at end of file
+})\r