+dofile(minetest.get_modpath("worldedit") .. "/spirals.lua")\r
--modifies positions `pos1` and `pos2` so that each component of `pos1` is less than or equal to its corresponding conent of `pos2`, returning two new positions\r
worldedit.sort_pos = function(pos1, pos2)\r
pos1 = {x=pos1.x, y=pos1.y, z=pos1.z}\r
return count\r
end\r
\r
+--adds a spiral at `pos` with size `size`, returning the number of nodes changed\r
+worldedit.spiral = function(pos, size, nodename)\r
+ local shift_x,shift_y\r
+ sa = spiralt(size)\r
+ shift_y = #sa -- "Height" of the Array\r
+ local fe = sa[1]\r
+ shift_x = #fe -- "Width" of the Array\r
+ fe = nil\r
+ \r
+ local count = 0\r
+ for x,v in ipairs(sa) do\r
+ for y, z in ipairs(v) do\r
+ minetest.env:add_node({x=pos.x-shift_x+x,y=pos.y-shift_y+y,z=pos.z+z}, {name=nodename})\r
+ count = count + 1\r
+ end\r
+ end\r
+ \r
+ return count\r
+end\r
+\r
--copies the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") by `amount` nodes, returning the number of nodes copied\r
worldedit.copy = function(pos1, pos2, axis, amount)\r
local pos1, pos2 = worldedit.sort_pos(pos1, pos2)\r
count = count + 1\r
end\r
return count\r
-end
\ No newline at end of file
+end\r