Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local torches=true --Fackeln an/aus (true/false)
- local rails=false --Schienen an/aus (true/false)
- local tl=100 --Tunnellaenge
- local fuelcheck=true --Turtles brauchen Fuel an/aus
- local pos=0
- local sr=true
- local function forward()
- while turtle.forward()==false do
- turtle.dig()
- turtle.attack()
- turtle.suck()
- sleep(.6)
- end
- end
- local function up()
- while turtle.up()==false do
- turtle.digUp()
- turtle.attackUp()
- turtle.suckUp()
- sleep(.6)
- end
- end
- local function down()
- while turtle.down()==false do
- turtle.digDown()
- turtle.attackDown()
- turtle.suckDown()
- sleep(.6)
- end
- end
- local function zurueck()
- if sr==false then
- turtle.turnLeft()
- forward()
- turtle.turnLeft()
- down()
- else
- turtle.turnLeft()
- turtle.turnLeft()
- down()
- end
- for i=pos, 1, -1 do
- forward()
- end
- end
- local function kceuruz()
- turtle.turnRight()
- turtle.turnRight()
- for i=1, pos, 1 do
- forward()
- end
- if sr==false then
- up()
- turtle.turnRight()
- forward()
- turtle.turnLeft()
- else
- up()
- end
- end
- local function check()
- if torches==true then
- if turtle.getItemCount(1)<=1 then
- if pos>0 then
- zurueck()
- end
- print("Keine Fackeln mehr. Bitte Fackeln in Slot 1 geben und [Enter] druecken")
- io.read()
- if pos>0 then
- kceuruz()
- end
- end
- if rails==true then
- if turtle.getItemCount(2)<=1 then
- if pos>0 then
- zurueck()
- end
- print("Keine Schienen mehr. Bitte Schienen in Slot 2 geben und [Enter] druecken")
- io.read()
- if pos>0 then
- kceuruz()
- end
- end
- end
- end
- end
- local function unload()
- if turtle.getItemCount(16)>0 then
- zurueck()
- local sn=3
- repeat
- turtle.select(sn)
- turtle.drop()
- sn=sn+1
- until sn==17
- turtle.select(1)
- kceuruz()
- end
- end
- local function fuel()
- if turtle.getFuelLevel()<=pos+3 then
- zurueck()
- turtle.select(3)
- print("Kein Treibstoff mehr. Bitte Treibstoff in Slot 3 geben und [Enter] druecken.")
- io.read()
- turtle.refuel()
- turtle.select(1)
- kceuruz()
- end
- end
- local function schicht()
- check()
- unload()
- if fuelcheck==true then
- fuel()
- end
- if sr==true then
- turtle.dig()
- forward()
- turtle.digUp()
- turtle.digDown()
- turtle.turnRight()
- turtle.dig()
- forward()
- turtle.digUp()
- turtle.digDown()
- if rails==true then
- turtle.select(2)
- turtle.placeDown()
- end
- turtle.turnLeft()
- elseif sr==false then
- turtle.dig()
- forward()
- turtle.digUp()
- turtle.digDown()
- if rails==true then
- turtle.select(2)
- turtle.placeDown()
- end
- turtle.turnLeft()
- turtle.dig()
- forward()
- turtle.digUp()
- turtle.digDown()
- turtle.turnRight()
- end
- sr=not sr
- pos=pos+1
- end
- local function fackel()
- if torches==true then
- turtle.select(1)
- turtle.turnRight()
- turtle.place()
- turtle.turnLeft()
- end
- end
- local function start()
- check()
- turtle.digUp()
- up()
- if tl>=4 then
- for i=1, 4, 1 do
- schicht()
- end
- fackel()
- tl=tl-4
- end
- end
- -----------------------------------
- start()
- for i=tl, 0, -1 do
- if i>=8 then
- for i=1, 8, 1 do
- schicht()
- end
- fackel()
- else
- schicht()
- end
- end
- zurueck()
- turtle.turnLeft()
- turtle.turnLeft()
- print("Bau des Tunnels scheint beendet.")
Advertisement
Add Comment
Please, Sign In to add comment