Advertisement
Guest User

startup

a guest
May 31st, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.02 KB | None | 0 0
  1. local arg = { ... }
  2. local x = 6
  3. local y = 6
  4.  
  5. function init()
  6.   if not arg[1] == nil then
  7.     x = tonumber(arg[1])
  8.         if x < 1 then
  9.       x = 6
  10.     end
  11.   end
  12.  
  13.   if not arg[2] == nil then
  14.     y = tonumber(arg[1])
  15.        if x < 1 then
  16.     x = 6
  17.     end
  18.   end
  19. end
  20.  
  21. function clearRow()
  22.   local z = 1
  23.  
  24.   while x > z do
  25.     if turtle.detectDown then
  26.       turtle.digDown()
  27.     end
  28.    
  29.     if turtle.detect() then
  30.       turtle.dig()
  31.     end
  32.    
  33.     turtle.forward()
  34.   end
  35.  
  36.   turtle.digDown()
  37. end
  38.  
  39. function turn(i)
  40.   if i == 0 then
  41.     turtle.turnRight()
  42.   else
  43.     turtle.turnLeft()
  44.   end
  45. end
  46.  
  47. function harvest()
  48.   turtle.up()
  49.  
  50.   if turtle.detect() then
  51.     turtle.dig()
  52.   end
  53.    
  54.   turtle.forward()
  55.  
  56.   local i = 0
  57.   local k = 1
  58.   while k < 6 do
  59.     clearRow()
  60.    
  61.     turn(i)
  62.    
  63.     if turtle.detect() then
  64.          turtle.dig()
  65.     end
  66.    
  67.        turtle.forward()
  68.     turn(i)
  69.    
  70.        k = k + 1
  71.    
  72.     if i == 1 then
  73.          i = 0
  74.        else
  75.          i = 1
  76.     end
  77.   end
  78. end
  79.  
  80.  
  81.  
  82.  
  83. init()
  84.  
  85. harvest()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement