SHARE
TWEET

Harvest 2.0

xbsktball10x May 20th, 2019 (edited) 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local i = 1
  2. local x = 1
  3. local y = 1
  4. local z = 0
  5.  
  6. local function empty()
  7.     for x=1,15 do
  8.         turtle.select(x)
  9.         turtle.dropUp()
  10.     end
  11. end
  12. local function turnAround(y)
  13.     if y%2 == 0 then
  14.         turtle.turnLeft()
  15.         turtle.forward()
  16.         turtle.turnLeft()
  17.         turtle.dig()
  18.     end
  19.     if y%2 == 1 then
  20.         turtle.turnRight()
  21.         turtle.forward()
  22.         turtle.turnRight()
  23.         turtle.dig()
  24.  
  25.     end
  26. end
  27. local function goHome(y)
  28.     turtle.up()
  29.     if y%2 == 1 then
  30.         turtle.turnRight()
  31.         turtle.turnRight()
  32.     end
  33.     repeat turtle.forward()
  34.     until turtle.forward()== false
  35.     turtle.turnRight()
  36.     repeat turtle.forward()
  37.     y = y - 1
  38.     until y == 1
  39.     turtle.turnRight()
  40. end
  41. local function till()
  42.     repeat 
  43.         turtle.dig()
  44.         turtle.forward()
  45.         turtle.select(16)
  46.     until turtle.compareDown()
  47.     turnAround(y)
  48. end
  49. local function endOfPlotCheck()
  50.     turtle.select(16)
  51.     if turtle.compareDown() == true then
  52.         turtle.forward()
  53.         if turtle.compareDown() == true then
  54.          turtle.forward()
  55.          if turtle.compareDown() == true then
  56.             return true
  57.          end
  58.         end
  59.     end
  60. end
  61. while true do
  62.  
  63. turtle.select(1)
  64. rednet.open("right")
  65. local senderId, msg = rednet.receive()
  66.  
  67. if msg == "harvest" then
  68.     turtle.forward()
  69.     turtle.digDown()
  70.     turtle.down()
  71.     repeat
  72.         till()
  73.         y = y + 1
  74.     until endOfPlotCheck()
  75.     goHome(y)
  76.     empty()
  77.     os.reboot()
  78. end
  79. end
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top