David_Turtle

Turtle "Minen"

Nov 21st, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.58 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3.  
  4. print("Turtle Miner v.1.3")
  5. print("")
  6. print("Die Turtle wird einen 3x3 Gang graben")
  7. print("Wie lange graben?")
  8.  
  9. local length = read()
  10. local torch = 0
  11. local left = length
  12.  
  13. function checkFuel()
  14.     if turtle.getFuelLevel() < 15 then
  15.         turtle.select(1)
  16.         turtle.refuel()
  17.     end
  18. end
  19. function digBlock()
  20.     while turtle.detect() do
  21.         turtle.dig()
  22.         os.sleep(0.5)
  23.     end
  24. end
  25. function digBlockUp()
  26.     while turtle.detectUp() do
  27.         turtle.digUp()
  28.         os.sleep(0.5)
  29.     end
  30. end
  31. function status()
  32.     print("[Slot 1] Treibstoff   [Slot 2] Fackeln")
  33.     print("")
  34.     print("Reihen uebrig : "..left)
  35.     print("Treibstoff : "..turtle.getFuelLevel())
  36. end
  37.  
  38. function digLayer()
  39.     for i=1,2 do
  40.         turtle.turnLeft()
  41.         digBlock()
  42.         turtle.turnRight()
  43.         turtle.turnRight()
  44.         digBlock()
  45.         turtle.turnLeft()
  46.         digBlockUp()
  47.         turtle.up()
  48.     end
  49.     turtle.turnLeft()
  50.     digBlock()
  51.     turtle.turnRight()
  52.     turtle.turnRight()
  53.     digBlock()
  54.     if torch == 8 then
  55.         turtle.forward()
  56.         turtle.turnRight()
  57.         turtle.forward()
  58.         turtle.select(2)
  59.         turtle.placeDown()
  60.         turtle.back()
  61.         turtle.turnLeft()
  62.         turtle.back()
  63.         torch = 0
  64.     end
  65.     turtle.turnLeft()
  66.     turtle.down()
  67.     turtle.down()
  68.     torch = torch + 1
  69.     left = left - 1
  70. end
  71.  
  72. for i=1,length do
  73.     turtle.dig()
  74.     turtle.forward()
  75.     term.clear()
  76.     term.setCursorPos(1,1)
  77.     checkFuel()
  78.     status()
  79.     digLayer()
  80. end
  81.  
  82. term.clear()
  83. term.setCursorPos(1,1)
  84. checkFuel()
  85. status()
  86. turtle.turnRight()
  87. turtle.turnRight()
  88. for i=0,length-3 do
  89.     turtle.forward()
  90. end
  91. term.clear()
  92. term.setCursorPos(1,1)
  93. checkFuel()
  94. status()
  95. print("Fertig!")
Advertisement
Add Comment
Please, Sign In to add comment