GNOOR1S

Turtle Clear Layer

Apr 21st, 2021
693
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Made By Gunnar
  2. -- 04/21/21
  3. local tArgs = {...}
  4. local width = tArgs[1]
  5. local length = tArgs[2]
  6.  
  7. local leftDir = 0
  8. local rightDir = 1
  9. local remainPointer = 0
  10.  
  11. function fuel()
  12.     if turtle.getFuelLevel() < 10 then
  13.         turtle.select(16)
  14.         turtle.refuel(1)
  15.         turtle.select(1)
  16.     end
  17. end
  18.  
  19. function forwardCheck()
  20.     while not turtle.forward() do
  21.         turtle.dig()
  22.     end
  23. end
  24.  
  25. function changeDir(dir)
  26.     if dir == leftDir then
  27.         return rightDir
  28.     elseif dir == rightDir then
  29.         return leftDir
  30.     end
  31. end
  32.  
  33. function turn(dir)
  34.     if dir == leftDir then
  35.         turtle.turnLeft()
  36.     elseif dir == rightDir then
  37.         turtle.turnRight()
  38.     end
  39. end
  40.  
  41. function run()
  42.     local dir = rightDir
  43.  
  44.     for z = 1, width do
  45.         for x = 1, length do
  46.             x = remainPointer + x
  47.             fuel()
  48.             turtle.dig()
  49.             forwardCheck()
  50.         end
  51.         remainPointer = 1
  52.         turn(dir)
  53.         turtle.dig()
  54.         forwardCheck()
  55.         turn(dir)
  56.         dir = changeDir(dir)
  57.     end
  58. end
  59.  
  60. run()
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×