Advertisement
NoobieDoobie

Untitled

Feb 26th, 2021
765
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. function Coal()
  2.   if turtle.getFuelLevel() < 40 and turtle.getItemCount(1) <2 then
  3.     print "Bitte Treibstoff in den 1. Slot geben"
  4.   end
  5. end
  6.  
  7. function Refuel()
  8.   if turtle.getFuelLevel() < 100 then
  9.     turtle.select(1)
  10.     turtle.refuel(turtle.getItemCount()-1)
  11.   end
  12. end
  13.  
  14. x=0
  15. y=0
  16.  
  17. function Mv()
  18.     Coal()
  19.     Refuel()
  20.     while not turtle.forward() do
  21.         turtle.attack()
  22.     end
  23. end
  24.  
  25. function Startup()
  26.     while turtle.forward() do
  27.         x=x+1
  28.     end
  29.     turtle.turnRight()
  30.     while turtle.forward() do
  31.         y=y+1
  32.     end
  33.     turtle.turnRight()
  34.     for l=0, x, 1 do
  35.         Mv()
  36.     end
  37.     turtle.turnRight()
  38.     for m=0, y, 1 do
  39.         Mv()
  40.     end
  41.     turtle.turnRight()
  42. end
  43.  
  44. function CheckBelow()
  45.     success, data = turtle.inspectDown()
  46.     if data.metadata == 7 then
  47.         turtle.digDown()
  48.         for i=0, 15, 1 do
  49.             slotData = turtle.getItemDetail(i)
  50.             if data.name == slotData.name then
  51.                 turtle.select(i)
  52.                 turtle.placeDown()
  53.                 break
  54.             end
  55.         end
  56. end
  57.  
  58. function CheckField()
  59.     for j=0, y, 1 do
  60.         for k=0, x, 1 do
  61.             CheckBelow()
  62.             Mv()
  63.         end
  64.         if j%2 == 0 then
  65.             turtle.turnRight()
  66.             Mv()
  67.             turtle.turnRight()
  68.         else
  69.             turle.turnLeft()
  70.             Mv()
  71.             turle.turnLeft()
  72.         end
  73. end
  74.  
  75. function TurnAround()
  76.     turtle.trunLeft()
  77.     turtle.turnLeft()
  78. end
  79.  
  80. function Chest()
  81.     TurnAround()
  82.     for n=5, 15, 1 do
  83.         turtle.select(n)
  84.         turtle.drop()
  85.     end
  86.     TurnAround()
  87. end
  88.  
  89. Startup()
  90. while true do
  91.     CheckField()
  92.     Chest()
  93.     os.sleep(300)
  94. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement