Advertisement
GopherAtl

shaver (cc turtle script)

Apr 16th, 2018
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. local args={...}
  2.  
  3. local dist = tonumber(args[1]) or 16
  4. local width = tonumber(args[2]) or 16
  5.  
  6. if dist*width*1.2<turtle.getFuelLevel() then
  7.     print("more fuel required")
  8.     return
  9. end
  10.  
  11. local turn={[0]=turtle.turnLeft, [1]=turtle.turnRight}
  12.  
  13.  
  14. for i=1,width do
  15.     turtle.digDown()
  16.     for j=1,dist-1 do
  17.         while turtle.detect() do
  18.           turtle.up()
  19.         end
  20.         turtle.forward()
  21.         turtle.digDown()
  22.     end
  23.     if i<width then
  24.         turn[i%2]()
  25.         turtle.forward()
  26.         turn[i%2]()
  27.     end
  28. end
  29.  
  30. --return to start
  31. turtle.back(dist-1)
  32. turtle.turnLeft()
  33. turtle.back(width-1)
  34. turtle.turnRight()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement