Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- length = 10
- --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
- --If turtle doesn't detect block in FRONT, Sleep for 300 Seconds
- if not turtle.detect() then
- print("Not ".."Detected, ".."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".."300 ".."Seconds")
- print("Fuel :"..turtle.getFuelLevel())
- 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
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- --CornerLeft
- cornerLeft()
- --Forward 10
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- --Small Corner Right
- turtle.turnRight()
- forward()
- turtle.turnRight()
- --Turn Corner, Forward 10
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- turtle.turnRight()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- turtle.turnRight()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- --Corner Right
- cornerRight()
- forward()
- forward()
- forward()
- forward()
- forward()
- forward()
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- forward()
- forward()
- forward()
- forward()
- turtle.turnRight()
- turtle.turnRight()
- forward()
- forward()
- forward()
- forward()
- print("Harvested!")
- print("Fuel :"..turtle.getFuelLevel())
- --End of harvest cycle
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement