Pfergy

3x3 Turtle Test

Sep 20th, 2019
96
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --Local Variables
  2.  
  3. local blocksMined = 0
  4. local fuelLevel = 0
  5.  
  6. --Move Functions
  7.  
  8. function turn180()
  9.     turtle.turnRight()
  10.     turtle.turnRight()
  11. end
  12.  
  13. --Check Functions
  14.  
  15. function checkFwd()
  16.     while turtle.detect() == true do
  17.         digFwd()
  18.     end
  19. end
  20.  
  21. function checkUp()
  22.     while turtle.detectUp() == true do
  23.         digUp()
  24.     end
  25. end
  26.  
  27. --1x3 Mine
  28.  
  29. function mine1x3()
  30.     checkFwd()
  31.     turtle.forward()
  32.     turtle.digUp()
  33.     checkUp()
  34.     turtle.digDown()
  35.     checkFuel()
  36. end
  37.  
  38. --3x3 Mine
  39.  
  40. function mine3x3()
  41.     mine1x3()
  42.     turtle.turnLeft()
  43.     mine1x3()
  44.     turn180()
  45.     turtle.forward()
  46.     turtle.forward()
  47.     mine1x3()
  48.    
  49.     --Reset
  50.     turtle.back()
  51.     turtle.right()
  52.    
  53.     --Count blocksMined
  54.     blocksMined = blocksMined + 1
  55. end
  56.  
  57. --Check Fuel Level
  58.  
  59. function checkFuel()
  60.     fuelLevel = turtle.getFuelLevel()
  61.     if turtle.getFuelLevel() == 0 then
  62.         turtle.refuel()
  63.     end
  64.     return fuelLevel
  65. end
  66.  
  67. function returnStart()
  68.     for i=0, blocksMined do
  69.         turtle.back()
  70.     end
  71. end
  72.  
  73. --Start Main Function
  74.  
  75. function main()
  76.     checkFuel()
  77.     for i=0, 25 do
  78.          mine3x3()
  79.     end
  80. end
  81.  
  82. main()
RAW Paste Data