Advertisement
Vestrosum

Stripmining Programm German by Vestrosum Version 1.0

Jul 30th, 2019
1,105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.13 KB | None | 0 0
  1. -- Strip mining Turtle Programm.
  2. -- Vestrosum, 29.07.19
  3. -- Version 1.0
  4.  
  5. -- Kraftstoff kommt in Slot 14,
  6. -- Fackeln für den Maintunnel kommt in Slot 15
  7. -- Fackeln für die Stripminetunnel kommt in Slot 16
  8.  
  9. -- Kraftstoff
  10. function checkFuel()
  11.   if turtle.getFuelLevel() <= 10 then
  12.     turtle.select(14)
  13.     turtle.refuel(1)
  14.     turtle.select(1)
  15.   end --if
  16. end --checkFuel
  17.  
  18. -- Umdrehen
  19. function turnAround()
  20.   turtle.turnLeft()
  21.   turtle.turnLeft()
  22. end --turnAround
  23.  
  24. -- Nächster Tunnel
  25. function digNext(torchCounter)
  26.   turtle.turnRight()
  27.   turtle.dig()
  28.   turtle.forward()
  29.   turtle.digUp()
  30.   turtle.dig()
  31.   turtle.forward()
  32.   turtle.digUp()
  33.   if torchCounter == 2 then
  34.  
  35.     turnAround()
  36.     turtle.select(15)
  37.     turtle.place()
  38.     turnAround()
  39.     print("Platziere Minenschacht Fackel")
  40.   end
  41.   turtle.turnLeft()
  42.   print("Drehe nach Rechts")
  43.   print("Nächster Tunnel")
  44. end
  45.  
  46.  
  47. -- Tunnel für die angegebene Länge
  48. function tunnel(givenLength)
  49.   local distance = 0
  50.   for index = 1,givenLength do
  51.     turtle.dig()
  52.     if turtle.forward() then
  53.       distance = distance + 1
  54.     end --if
  55.     turtle.digUp()
  56.     turtle.select(1)
  57.     turtle.placeDown()
  58.  
  59. -- Fackeln alle 10 Blöcke
  60.  
  61.     if distance == 10 then
  62.       turtle.select(16)
  63.       print("Platziere Tunnel Fackel...")
  64.       turnAround()
  65.       turtle.place()
  66.       turnAround()
  67.       distance = 0
  68.       checkFuel()
  69.     end --if
  70.   end --for
  71.  
  72. -- Turtle kehrt an den Anfang zurück
  73.   turtle.up()
  74.   for index = 1,givenLength do
  75.     turtle.back()
  76.   end --for
  77.   turtle.down()
  78.   turtle.drop()
  79. end --tunnel
  80.  
  81. -- Main Script
  82. print("Kraftstoff in Slot 14.")
  83. print("Fackeln fuer den Maintunnel in Slot 15.")
  84. print("Fackeln fuer den Minenschacht in Slot 16.")
  85. print("Tunnellaenge:")
  86. local length = read()
  87. print("Tunnelanzahl:")
  88. local quantity = read()
  89. local torchNext = 0
  90. print("Beginne den Auftrag...")
  91. checkFuel()
  92.  
  93. -- Tunnel loop
  94.   for index=1,quantity do
  95.     if torchNext == 3 then
  96.       torchNext = 0
  97.     end
  98.     tunnel(length)
  99.     checkFuel()
  100.     digNext(torchNext)
  101.     torchNext = torchNext + 1
  102.   end
  103. print("Der Auftrag wurde ausgeführt!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement