Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Strip mining Turtle Programm.
- -- Vestrosum, 29.07.19
- -- Version 1.0
- -- Kraftstoff kommt in Slot 14,
- -- Fackeln für den Maintunnel kommt in Slot 15
- -- Fackeln für die Stripminetunnel kommt in Slot 16
- -- Kraftstoff
- function checkFuel()
- if turtle.getFuelLevel() <= 10 then
- turtle.select(14)
- turtle.refuel(1)
- turtle.select(1)
- end --if
- end --checkFuel
- -- Umdrehen
- function turnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end --turnAround
- -- Nächster Tunnel
- function digNext(torchCounter)
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- turtle.dig()
- turtle.forward()
- turtle.digUp()
- if torchCounter == 2 then
- turnAround()
- turtle.select(15)
- turtle.place()
- turnAround()
- print("Platziere Minenschacht Fackel")
- end
- turtle.turnLeft()
- print("Drehe nach Rechts")
- print("Nächster Tunnel")
- end
- -- Tunnel für die angegebene Länge
- function tunnel(givenLength)
- local distance = 0
- for index = 1,givenLength do
- turtle.dig()
- if turtle.forward() then
- distance = distance + 1
- end --if
- turtle.digUp()
- turtle.select(1)
- turtle.placeDown()
- -- Fackeln alle 10 Blöcke
- if distance == 10 then
- turtle.select(16)
- print("Platziere Tunnel Fackel...")
- turnAround()
- turtle.place()
- turnAround()
- distance = 0
- checkFuel()
- end --if
- end --for
- -- Turtle kehrt an den Anfang zurück
- turtle.up()
- for index = 1,givenLength do
- turtle.back()
- end --for
- turtle.down()
- turtle.drop()
- end --tunnel
- -- Main Script
- print("Kraftstoff in Slot 14.")
- print("Fackeln fuer den Maintunnel in Slot 15.")
- print("Fackeln fuer den Minenschacht in Slot 16.")
- print("Tunnellaenge:")
- local length = read()
- print("Tunnelanzahl:")
- local quantity = read()
- local torchNext = 0
- print("Beginne den Auftrag...")
- checkFuel()
- -- Tunnel loop
- for index=1,quantity do
- if torchNext == 3 then
- torchNext = 0
- end
- tunnel(length)
- checkFuel()
- digNext(torchNext)
- torchNext = torchNext + 1
- end
- print("Der Auftrag wurde ausgeführt!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement