Advertisement
Pirnogion

mt_farm

Oct 19th, 2014
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | None | 0 0
  1. local count = 1
  2. local line = 1
  3.  
  4. turtle.select(1)
  5.  
  6. local function reset()
  7.  turtle.turnLeft()
  8.  for i = 1, 8 do turtle.forward() end
  9.  turtle.turnLeft()
  10.  for i = 1, 8 do turtle.forward() end
  11.  
  12.  for i = 16, 2, -1 do
  13.   turtle.select(i)
  14.   turtle.drop()
  15.  end
  16.  
  17.  turtle.turnLeft()
  18.  turtle.turnLeft()
  19.  
  20.  count = 1
  21.  line = 1
  22. end
  23.  
  24. local function Handle()
  25.  local s, d = turtle.inspectDown()
  26.  
  27.  if (d.metadata == 7) then
  28.   turtle.digDown()
  29.   turtle.suckDown()
  30.  end
  31.  
  32.  if (turtle.getItemCount() > 0) then
  33.   turtle.placeDown()
  34.  end
  35. end
  36.  
  37. local function TurnRFR()
  38.  turtle.turnRight()
  39.  turtle.forward()
  40.  turtle.turnRight()
  41. end
  42.  
  43. local function TurnLFL()
  44.  turtle.turnLeft()
  45.  turtle.forward()
  46.  turtle.turnLeft()
  47. end
  48.  
  49. local function Info()
  50.  term.clear()
  51.  term.setCursorPos(1, 1)
  52.  print("Farming. Blocks processed: ", count, ". Line: ", line, ".")
  53. end
  54.  
  55. while true do
  56.  Info()
  57.  
  58.  if (count == 81) then reset() print("Complete!") break end
  59.  
  60.  if (count % 9 ~= 0) then
  61.   Handle()
  62.   turtle.forward()
  63.   count = count + 1
  64.  else
  65.   Handle()
  66.   if (line % 2 ~= 0) then TurnRFR()
  67.   else TurnLFL() end
  68.   count = count + 1
  69.   line = line + 1
  70.  end
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement