Advertisement
Guest User

Untitled

a guest
Jan 20th, 2020
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.28 KB | None | 0 0
  1. function checkUp()
  2.     local needFuel = 0
  3.     local needTorch = 0
  4.     local needEmpty = 0
  5.  
  6.     if turtle.getFuelLevel() < 10 then
  7.         needFuel = 1
  8.     end
  9.     if turtle.getItemCount(4) == 0 then
  10.         needTorch = 1
  11.     end
  12.     if turtle.getItemCount(16) > 0 then
  13.         needEmpty = 1
  14.     end
  15.  
  16.     if needFuel == 1 or needTorch == 1 or needEmpty == 1 then
  17.         turtle.turnRight()
  18.         turtle.turnRight()
  19.     else
  20.         return
  21.     end
  22.     if needFuel == 1 then
  23.         turtle.select(1)
  24.         turtle.place()
  25.         turtle.suck()
  26.         turtle.refuel()
  27.         turtle.dig()
  28.     end
  29.     if needTorch == 1 then
  30.         turtle.select(2)
  31.         turtle.place()
  32.         turtle.select(4)
  33.         turtle.suck()
  34.         turtle.select(2)
  35.         turtle.dig()
  36.     end
  37.     turtle.select(3)
  38.     turtle.place()
  39.     for i = 5, 16 do
  40.         turtle.select(i)
  41.         turtle.drop()
  42.     end
  43.     turtle.select(3)
  44.     turtle.dig()
  45.     turtle.turnRight()
  46.     turtle.turnRight()
  47.     return
  48. end
  49.  
  50. local dist = 30
  51. for i = 0, dist do
  52.     while turtle.detect() do
  53.         turtle.dig()
  54.         checkUp()
  55.     end
  56.     turtle.forward()
  57.     while turtle.detectUp() or turtle.detectDown() do
  58.         turtle.digUp()
  59.         checkUp()
  60.         turtle.digDown()
  61.         checkUp()
  62.     end
  63.     turtle.forward()
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement