Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- length = 100
- --Setting loop length
- --Each time turtle does not detect, or detects, counts as 1 cycle of loop
- for i=1, length, 1 do
- --Function hits block in front, then moves forward
- function forward()
- turtle.dig()
- turtle.forward()
- end
- --Function turns right, Forward 3, Turns right
- function cornerRight()
- turtle.turnRight()
- forward()
- forward()
- forward()
- turtle.turnRight()
- end
- --Function turns left, Forward 3, Turns left
- function cornerLeft()
- turtle.turnLeft()
- forward()
- forward()
- forward()
- turtle.turnLeft()
- end
- -- **not used currently** If turtle doesn't detect block in FRONT, Sleep for 300 Seconds
- --if not turtle.detect() then
- --sleep(x)
- --end
- --If turtle does detect block in FRONT, start harvest cycle
- --if turtle.detect() then
- --print("***Detected! ".."Now ".."Harvesting!")
- print("Fuel :"..turtle.getFuelLevel())
- --Forward 6 blocks
- i = 0
- repeat
- forward()
- i = i + 1
- until i == 6
- --CornerLeft
- cornerLeft()
- --Forward 10
- i = 0
- repeat
- forward()
- i = i + 1
- until i == 10
- --Small Corner Right
- turtle.turnRight()
- forward()
- turtle.turnRight()
- --Turn Corner, Forward 10
- i = 0
- repeat
- forward()
- i = i + 1
- until i == 10
- turtle.turnRight()
- i = 0
- repeat
- forward()
- i = i + 1
- until i == 8
- turtle.turnRight()
- i = 0
- repeat
- forward()
- i = i + 1
- until i == 12
- --Corner Right
- cornerRight()
- i = 0
- repeat
- forward()
- i = i + 1
- until i == 10
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- i = 0
- repeat
- forward()
- i = i + 1
- until i == 8
- turtle.turnRight()
- turtle.turnRight()
- forward()
- forward()
- forward()
- forward()
- print("Harvested!")
- print("Fuel :"..turtle.getFuelLevel())
- --End of harvest cycle
- print("Sleeping ".."For ".."600 ".."Seconds")
- sleep(50)
- print("Sleeping ".."For ".."550 ".."Seconds")
- sleep(50)
- print("Sleeping ".."For ".."500 ".."Seconds")
- sleep(50)
- print("Sleeping ".."For ".."450 ".."Seconds")
- sleep(50)
- print("Sleeping ".."For ".."400 ".."Seconds")
- sleep(50)
- print("Sleeping ".."For ".."350 ".."Seconds")
- sleep(50)
- print("Sleeping ".."For ".."300 ".."Seconds")
- sleep(50)
- print("Sleeping ".."For ".."250 ".."Seconds")
- sleep(50)
- print("Sleeping ".."For ".."200 ".."Seconds")
- sleep(50)
- print("Sleeping ".."For ".."150 ".."Seconds")
- sleep(50)
- print("Sleeping ".."For ".."100 ".."Seconds")
- sleep(50)
- print("Sleeping ".."For ".."50 ".."Seconds")
- sleep(50)
- print("Slept ".."For ".."600 ".."Seconds")
- print("Fuel :"..turtle.getFuelLevel())
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement