Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Harvest Rows of Cane
- -- 170218 Upgraded to three sets
- RowLength=10
- NumSetsCrop=3
- function GetIntoPos()
- turtle.up()
- turtle.up()
- end -- function GetIntoPos()
- function HarvestRow()
- for x=1,10,1 do
- turtle.dig()
- turtle.forward()
- end -- RowLength loop
- end -- function HarvestRow
- function TurnBackLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.forward()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- end -- function TurnBackLeft
- function TurnBackRight()
- turtle.turnRight()
- turtle.forward()
- turtle.forward()
- -- turtle.dig()
- turtle.turnRight()
- end -- function TurnBackRigth
- ----------------------------------
- -- Return to home position and lower after pass over all crops
- function ReturnHome()
- turtle.turnLeft()
- turtle.forward()
- if NumSetsCrop>1 then
- for x=1,NumSetsCrop-1,1 do
- turtle.forward()
- turtle.forward()
- turtle.forward()
- end -- of Number of Sets of Crops
- end -- if more than one row of crops
- turtle.turnLeft()
- turtle.down()
- end -- function ReturnHome
- -------------------------------
- -- Unload turtle into storage
- function UnLoad()
- turtle.turnLeft()
- for x=1,16,1 do
- turtle.drop(x)
- end
- turtle.turnRight()
- end -- function UnLoad
- function HarvestLap()
- HarvestRow()
- TurnBackLeft()
- HarvestRow()
- TurnBackRight()
- HarvestRow()
- TurnBackLeft()
- HarvestRow()
- TurnBackRight()
- HarvestRow()
- TurnBackLeft()
- HarvestRow()
- end -- of function HarvestLap
- function HarvestCrop()
- print("Running Harvest Routine")
- print("Fuel Level: ", turtle.getFuelLevel())
- GetIntoPos()
- HarvestLap()
- ReturnHome()
- HarvestLap()
- ReturnHome()
- UnLoad()
- end -- HarvestCrop
- -- Main Routine
- print("Name: ", os.getComputerLabel() )
- while (turtle.getFuelLevel()>100) do
- HarvestCrop()
- print("Waiting for Growth")
- print("FuelLevel: ", turtle.getFuelLevel())
- sleep(300)
- end
- if turtle.getFuelLevel()<100 then
- print("Out of Fuel: ", turtle.getFuelLevel())
- end
Advertisement
Add Comment
Please, Sign In to add comment