AdditionalPylons

cactus.lua

Jun 11th, 2026 (edited)
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local l,w = ...
  2. if l==nil then
  3.     l,w = settings.get("cactus_l",16),settings.get("cactus_w",8)
  4.     print("Size not specified, defaulting to preset... ("..l.."x"..w..")")
  5. else
  6.     print("Saved size. Now can be called without args.")
  7.     settings.set("cactus_l",l)
  8.     settings.set("cactus_w",w)
  9.     settings.save()
  10. end
  11. for i=1,3 do turtle.up() end
  12. local b=true
  13. local s=0
  14. local function rotate()
  15.     if b then
  16.         turtle.turnRight()
  17.         turtle.forward()
  18.         turtle.turnRight()
  19.         s=1
  20.     else
  21.         turtle.turnLeft()
  22.         turtle.forward()
  23.         turtle.turnLeft()
  24.         s=2
  25.     end
  26.     b=not b
  27. end
  28.  
  29. for i=1,w do
  30.     local dl
  31.     if s==1 then dl=l-1 else dl=l end
  32.     for i=1,dl do
  33.     if s==0 then
  34.         turtle.forward()
  35.         turtle.forward()
  36.     elseif s==1 then
  37.         turtle.forward()
  38.     else
  39.         turtle.back()
  40.     end
  41.        
  42.     turtle.digDown()
  43.     turtle.down()
  44.     turtle.digDown()
  45.     turtle.up()
  46.     s=0
  47.     end
  48.     rotate()
  49. end
  50.    
  51. while turtle.down() do end
Advertisement
Add Comment
Please, Sign In to add comment