Advertisement
TinaTheDerpy

Harvester

Dec 21st, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.52 KB | None | 0 0
  1. local x, y, z = gps.locate()
  2. row = {514, 518, 521, 525, 528, 532}
  3. local row_Count = 1
  4. drop = {520, 527}
  5. local drop_Count = 1
  6.  
  7. function reverse()
  8.    turtle.turnLeft()
  9.    turtle.turnLeft()
  10. end
  11.  
  12. function up_Line()
  13.    reverse()
  14.    for i = 1, 5 do
  15.       turtle.forward()
  16.    end
  17.    turtle.up()
  18.    for j = 1, 7 do
  19.       turtle.forward()
  20.    end
  21.    turtle.up()
  22.    for k = 1, 7 do
  23.       turtle.forward()
  24.    end
  25.    row_Count = 1
  26.    drop_Count = 1
  27.    reverse()
  28. end
  29.  
  30. function clear()
  31.    if turtle.detect() == true then
  32.       turtle.dig()
  33.    end
  34. end
  35.  
  36. function check()
  37.    turtle.select(2)
  38.    if turtle.compare() then
  39.       while turtle.detect() == true do
  40.          turtle.dig()
  41.       end
  42.       turtle.select(1)
  43.       turtle.place()
  44.    end
  45. end
  46.  
  47. function check_Row()
  48.    turtle.turnLeft()
  49.    check()
  50.    reverse()
  51.    check()
  52.    turtle.turnLeft()
  53. end
  54.  
  55. function at_Row()
  56.    x, y, z = gps.locate()
  57.    if z == row[row_Count] then
  58.    print("I am at row "..row_Count.."")
  59.       check_Row()
  60.       row_Count = row_Count + 1
  61.    end
  62. end
  63.  
  64. function at_Drop()
  65.    x, y, z = gps.locate()
  66.    if z == drop[drop_Count] then
  67.       print("I am at drop "..drop_Count.."")
  68.       turtle.down()
  69.       drop_Count = drop_Count + 1
  70.    end
  71. end
  72.  
  73.  
  74. function down_Line()
  75.    for i = 1, 19 do
  76.       clear()
  77.       at_Row()
  78.       at_Drop()
  79.       turtle.forward()
  80.    end
  81. end
  82.  
  83. -- Main Func --
  84. while true do
  85.    local time = os.time()
  86.    if time == 12.000 then
  87.       down_Line()
  88.       up_Line()
  89.    end
  90.    sleep(0.05)
  91. end
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement