Advertisement
Guest User

startup.lua

a guest
Apr 4th, 2020
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.77 KB | None | 0 0
  1. lane=0
  2. sleep(2)
  3. function fuelup()
  4.     if turtle.getFuelLevel()<=2000 then
  5.         print("Getting fuel")
  6.         turtle.down()
  7.         turtle.down()
  8.         turtle.select(1)
  9.         turtle.suckDown()
  10.         turtle.refuel()
  11.         turtle.up()
  12.         turtle.up()
  13.     end
  14. end
  15. function empty()
  16.     turtle.down()
  17.     turtle.down()
  18.     for x=1,16 do
  19.         turtle.select(x)
  20.         turtle.dropDown()
  21.         print("Emptied slot",x)
  22.     end
  23.     turtle.up()
  24.     turtle.up()
  25. end
  26. function theend()
  27.     if turtle.detect() then
  28.         turtle.turnRight()
  29.         if turtle.detect() then
  30.             print("Found the end")
  31.             empty()
  32.             turtle.turnRight()
  33.             turtle.turnRight()
  34.             while turtle.detect()==false do
  35.                 turtle.forward()
  36.             end
  37.             turtle.turnLeft()
  38.             lane=0
  39.             fuelup()
  40.             print("5 second cooldown")
  41.             sleep(5)
  42.         else
  43.             turtle.forward()
  44.             turtle.suckUp()
  45.             turtle.turnRight()
  46.         end
  47.     else
  48.         turtle.turnLeft()
  49.     end
  50. end
  51. function collect()
  52.     while true do
  53.         print(lane)
  54.         lane=lane+1
  55.         turtle.suckUp()
  56.         turtle.forward()
  57.         if turtle.detect() and lane%2~=0 then
  58.             turtle.turnLeft()
  59.             turtle.forward()
  60.             turtle.suckUp()
  61.             turtle.turnLeft()
  62.         elseif turtle.detect() and lane%2==0 then
  63.             if lane>60 then
  64.                 print("Checking for end of path")
  65.                 theend()
  66.            
  67.             else
  68.                 turtle.turnRight()
  69.                 turtle.forward()
  70.                 turtle.suckUp()
  71.                 turtle.turnRight()
  72.             end
  73.         end
  74.     end
  75. end
  76. collect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement