Advertisement
SythsGod

3x3 digging

Jul 1st, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. -- 0.4 3x3
  2.  
  3. local x = 15
  4. local fuelLevelStart = turtle.getFuelLevel()
  5. local fuelUsed = 100
  6.  
  7. function dig()
  8.     turtle.turnRight()
  9.     turtle.dig()
  10.     turtle.digDown()
  11.     turtle.down()
  12.     turtle.dig()
  13.     turtle.turnLeft()
  14.     turtle.turnLeft()
  15.     turtle.dig()
  16.     turtle.up()
  17.     turtle.dig()
  18.     turtle.digUp()
  19.     turtle.up()
  20.     turtle.dig()
  21.     turtle.turnRight()
  22.     turtle.turnRight()
  23.     turtle.dig()
  24.     turtle.turnLeft()
  25.     turtle.down()
  26. end
  27.  
  28. function torch()
  29.     turtle.select(16)
  30.     turtle.placeDown()
  31.     turtle.select(1)
  32. end
  33.  
  34. if fuelLevelStart < fuelUsed then error("Insufficient fuel") end
  35.  
  36. for i = 1, x, 1 do
  37.     turtle.dig()
  38.     turtle.forward()
  39.     dig()
  40.  
  41.     if i == 4 then torch() end
  42.     if i == 12 then torch() end
  43. end
  44.  
  45. for i = 1, x, 1 do
  46.     turtle.back()
  47. end
  48.  
  49. print("Finished! Total fuel used: " .. fuelLevelStart - turtle.getFuelLevel())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement