mjmac85

brokenTunnel

Jan 1st, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.50 KB | None | 0 0
  1. local function fuel(currentSlot)
  2.     while turtle.getFuelLevel() <= 5 do
  3.         turtle.select(16)
  4.         turtle.refuel(1)
  5.         print(turtle.getFuelLevel())
  6.     end
  7.  
  8.     turtle.select(currentSlot)
  9.  
  10. end
  11.  
  12.  
  13. local function mine(currentSlot)
  14.     fuel(currentSlot)
  15.     while turtle.forward() == false do
  16.         print("dig")
  17.         turtle.dig()
  18.     end
  19.     --    turtle.forward()
  20.     checkDown(currentSlot)
  21.     print("Made it")
  22.     turtle.digUp()
  23. end
  24.  
  25. local function checkDown(currentSlot)
  26.     if turtle.detectDown() == false then
  27.         turtle.select(1)
  28.         turtle.placeDown()
  29.         turtle.select(currentSlot)
  30.     end
  31.    
  32. end
  33.  
  34.  
  35.  
  36. local function inventoryCheck()
  37.     if turtle.getItemCount(14) > 0 then
  38.         dropItems()
  39.     end
  40. end
  41.  
  42. local function dropItems(distance, currentSlot)
  43.     local back = 0
  44.     turtle.turnRight()
  45.     turtle.turnRight()
  46.     while back <= distance do
  47.         fuel(currentSlot)
  48.         turtle.forward()
  49.         back = back - 1
  50.     end
  51.    
  52.  
  53.  
  54. end
  55.  
  56. local function main()
  57.     local fuelSlot = 16
  58.     local currentSlot = 1
  59.     local bridgeSlot = 1
  60.     local torchSlot = 2
  61.     local distance = 0
  62.     fuel(currentSlot)
  63.     turtle.select(fuelSlot)
  64.     inventoryCheck(distance, currentSlot)
  65.     mine(currentSlot)
  66.     distance = distance + 1
  67.     if distance % 8 == true then
  68.         turtle.turnLeft()
  69.         turtle.select(1)
  70.         turtle.place()
  71.         turtle.turnRight()
  72.         turtle.select(currentSlot)
  73.     end
  74. end
  75.  
  76. main()
Advertisement
Add Comment
Please, Sign In to add comment