Advertisement
Guest User

Harvester

a guest
Aug 22nd, 2014
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.89 KB | None | 0 0
  1. function PickupItems()
  2.    turtle.turnRight()
  3.    turtle.select(1)
  4.    
  5.    --Imports coal & 2 stacks of seeds
  6.    --from the chest to the right.
  7.    for i = 1, 3 do
  8.       turtle.suck()
  9.    end -- end for
  10.    
  11.    turtle.turnLeft()
  12. end -- end function
  13.    
  14.    
  15. function Refuel()
  16.    if turtle.getFuelLevel() < 20 then
  17.       turtle.refuel(1)
  18.    else
  19.       print(turtle.getFuelLevel())
  20.    end -- end if
  21. end -- end function
  22.    
  23. function GetReady()
  24.    --Moves the turtle into a starting
  25.    --position.
  26.    turtle.up(1)
  27.    turtle.forward(1)
  28.    
  29.    --Selects seeds to plant
  30.    turtle.select(2)
  31. end -- end function
  32.    
  33. function Harvest()
  34.    local turnCount = 1
  35.    for i = 1, 9 do --number of rows
  36.       if i == 5 then -- middle row has sprinkler to avoid
  37.           for j = 1, 4 do
  38.              turtle.forward(1)
  39.              turtle.digDown()
  40.              turtle.placeDown()
  41.           end -- end for
  42.           turtle.forward(1)
  43.           for j =1, 4 do
  44.              turtle.forward(1)
  45.              turtle.digDown()
  46.              turtle.placeDown()
  47.           end -- end for
  48.       else
  49.          for k = 1, 9 do --number of tiles in 1 row
  50.             turtle.forward(1)
  51.             turtle.digDown()
  52.             turtle.placeDown()
  53.          end--end for
  54.       end -- end if
  55.       Refuel()
  56.            
  57.       if turnCount % 2 == 0 then
  58.          turtle.turnLeft()
  59.       else
  60.          turtle.turnRight()
  61.       end --end if
  62.          
  63.       turtle.forward(1)
  64.       turtle.digDown()
  65.       turtle.placeDown()
  66.      
  67. --      if i == 10 then
  68. --         break
  69. --      end--end if
  70.  
  71.       if turnCount % 2 == 0 then
  72.          turtle.turnLeft()
  73.       else
  74.          turtle.turnRight()
  75.       end -- end if  
  76.      
  77.       turnCount = turnCount + 1
  78.      
  79.    end --end for loop
  80. end--end function
  81.  
  82. function ReturnToStart()
  83. end        
  84.    
  85. --main
  86. PickupItems()
  87. Refuel()
  88. GetReady()
  89. Harvest()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement