Advertisement
Ezteyh

TurtleDelivery

Jun 18th, 2021
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.25 KB | None | 0 0
  1. local fin = 0
  2.  
  3. function succ()
  4.     while (turtle.getItemCount(16) < 1) do
  5.         turtle.suck()
  6.     end
  7.     turtle.suck()
  8. end
  9.  
  10. function up()
  11.     for i = 1, 23, 1 do
  12.         turtle.digUp()
  13.         turtle.up()
  14.     end
  15. end
  16.  
  17. function zadjust()
  18.     for i = 1, 11, 1 do
  19.         turtle.back()
  20.     end
  21.     turtle.turnLeft()
  22. end
  23.  
  24. function xadjust()
  25.     for i = 1, 41, 1 do
  26.         turtle.dig()
  27.         turtle.forward()
  28.     end
  29. end
  30.  
  31. function yadjust()
  32.     while not turtle.detectDown() do
  33.     turtle.down()
  34.     end
  35. end
  36.  
  37. function flush()
  38.     for i = 1, 16, 1 do
  39.         turtle.select(i)
  40.         turtle.dropDown()
  41.     end
  42.     fin = 1
  43. end
  44.  
  45. function retour()
  46.     if fin == 1 then
  47.         while not turtle.detectUp() do
  48.             turtle.up()
  49.         end
  50.         turtle.turnRight()
  51.         turtle.turnRight()
  52.         for i = 1, 41, 1 do
  53.             turtle.dig()
  54.             turtle.forward()
  55.         end
  56.         turtle.turnLeft()
  57.         for i = 1, 11, 1 do
  58.             turtle.back()
  59.         end
  60.         while not turtle.detectDown() do
  61.             turtle.down()
  62.         end
  63.         turtle.select(1)
  64.     end
  65. end
  66.  
  67. while (1) do
  68.     succ()
  69.     up()
  70.     zadjust()
  71.     xadjust()
  72.     yadjust()
  73.     flush()
  74.     retour()
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement