Advertisement
David_Turtle

Turtle "Conduit Placer"

Jan 23rd, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.18 KB | None | 0 0
  1. term.clear()
  2. term.setCursorPos(1,1)
  3.  
  4. print("Conduit Placer v.1.0")
  5. print("")
  6. print("Die Turtle gräbt einen 1x3 Gang")
  7. print("Und plaziert oben Conduits")
  8. print("")
  9. print("Enter drücken...")
  10. local temp = read()
  11.  
  12. term.clear()
  13. term.setCursorPos(1,1)
  14.  
  15. print("[Slot 1] Treibstoff")
  16. print("[Slot 2] Conduit")
  17. print("[Slot 3] Fackeln")
  18. print("")
  19. print("Wie lange graben?")
  20.  
  21. local length = tonumber(read())
  22.  
  23. if (not length) then
  24.  
  25.     term.clear()
  26.     term.setCursorPos(1,1)
  27.  
  28.     print("")
  29.     print("gute arbeit jens")
  30.     os.sleep(10)
  31.     os.reboot()
  32.  
  33. end
  34.  
  35. if (length > 64) then
  36.  
  37.     term.clear()
  38.     term.setCursorPos(1,1)
  39.     print("Die Länge ist größer als ein Stack!")
  40.     print("Nach 64 werden andere Blöcke platziert")
  41.     print("")
  42.     print("Wirklich fortfahren? (y/n)")
  43.  
  44.     local answer = read()
  45.  
  46.     if (answer == "y" or answer == "Y") then
  47.  
  48.         --nichts
  49.  
  50.     else
  51.  
  52.         term.clear()
  53.         term.setCursorPos(1,1)
  54.        
  55.         print("Turtle wird sich neustarten...")
  56.         os.sleep(3)
  57.         os.reboot()
  58.  
  59.     end
  60.  
  61. end
  62.  
  63. local torch = 0
  64. local left = length
  65.  
  66. function checkFuel()
  67.     if turtle.getFuelLevel() < 15 then
  68.         turtle.select(1)
  69.         turtle.refuel()
  70.     end
  71. end
  72.  
  73. function digBlock()
  74.  
  75.     while turtle.detect() do
  76.         turtle.dig()
  77.         os.sleep(0.5)
  78.     end
  79.  
  80. end
  81. function digBlockUp()
  82.     while turtle.detectUp() do
  83.         turtle.digUp()
  84.         os.sleep(0.5)
  85.     end
  86. end
  87. function digBlockDown()
  88.     while turtle.detectDown() do
  89.         turtle.digDown()
  90.         os.sleep(0.5)
  91.     end
  92. end
  93.  
  94. function status()
  95.  
  96.     term.clear()
  97.     term.setCursorPos(1,1)
  98.  
  99.     print("[Slot 1] Treibstoff")
  100.     print("[Slot 2] Conduit")
  101.     print("[Slot 3] Fackeln")
  102.     print("")
  103.  
  104.     print("Reihen uebrig : "..left)
  105.     print("Treibstoff : "..turtle.getFuelLevel())
  106.  
  107. end
  108.  
  109. checkFuel()
  110.  
  111. digBlockUp()
  112. turtle.up()
  113.  
  114. for i=1,length do
  115.  
  116.     digBlock()
  117.     turtle.forward()
  118.  
  119.     digBlockUp()
  120.     digBlockDown()
  121.  
  122.     turtle.select(2)
  123.     turtle.placeUp()
  124.  
  125.     if (torch == 8) then
  126.  
  127.         torch = 0
  128.  
  129.         turtle.select(3)
  130.         turtle.placeDown()
  131.  
  132.     else
  133.  
  134.         torch = torch + 1
  135.  
  136.     end
  137.  
  138.     checkFuel()
  139.     status()
  140.  
  141.     left = left - 1
  142.  
  143. end
  144.  
  145. turtle.turnRight()
  146. turtle.turnRight()
  147.  
  148. for i=0,length-2 do
  149.     turtle.forward()
  150. end
  151.  
  152. turtle.down()
  153.  
  154. term.clear()
  155. term.setCursorPos(1,1)
  156.  
  157. print("Fertig!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement