SHARE
TWEET

test.lua

a guest Jan 20th, 2020 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. end
  38.  
  39. local dist = 30
  40. for i = 0, dist do
  41.     while turtle.detect() do
  42.         turtle.dig()
  43.         checkUp()
  44.     end
  45.     turtle.forward()
  46.     while turtle.detectUp() or turtle.detectDown() do
  47.         turtle.digUp()
  48.         checkUp()
  49.         turtle.digDown()
  50.         checkUp()
  51. turtle.select(3)
  52. turtle.place()
  53. for i = 5, 16 do
  54.     turtle.select(i)
  55.     turtle.drop()
  56. end
  57. turtle.select(3)
  58. turtle.dig()
  59. turtle.turnRight()
  60. turtle.turnRight()
  61. return
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top