Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- length = 0
- count = 0
- args = {...}
- if args[1] == "0" or args[1] == nil then
- print("Korrektes Format lautet: mine <Ganglaenge> <Anzahl Abzweigungen> " )
- print("Ebefalls moeglich: mine <Ganglaenge>")
- print("Nix zu tun, fahre herunter !")
- return(0)
- else
- length = args[1]+0 -- bugfixes string
- end
- if args[2] == "0" or args[2] == nil then
- count = 0
- else
- count = args[2]+0
- end
- print("Fuehre aus: Zonkotron Miner V 0.2")
- print("Loescher Boehren!")
- print("Laenge:".. length)
- print("count:" .. count)
- function turn() -- Turns 180
- turtle.turnRight()
- turtle.turnRight()
- end
- function lDig(x) -- Digs a tunnel 2 spaces below cleared room
- for i=1,x,1 do
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- if turtle.detectDown() then
- turtle.digDown()
- end
- end -- end of for 1,x,1
- end -- end of tDig()
- function tDig(x) -- Digs a tunnel 3 label set ZONK
- for i=1,x,1 do
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- turtle.forward()
- if turtle.detectDown() then
- turtle.digDown()
- end
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.5)
- end
- end -- end of for 1,x,1
- end -- end of tDig()
- function sDig(y) -- Digs in a straight line
- for i=1,y,1 do
- if turtle.detect() then
- turtle.dig()
- end
- turtle.forward()
- end
- end -- end function
- function uDig(x) -- Digs an upper 2 high clearance tunnel
- for i=1,x,1 do
- while turtle.detect() do
- turtle.dig()
- sleep(0.5)
- end
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.forward()
- end -- end of for 1,x,1
- end -- end of tDig()
- -- Start Hauptprogramm
- if count == nil or count == 0 then
- for i=1,3,1 do
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.5)
- end
- turtle.up()
- end
- uDig(length)
- turn()
- for i=1,2,1 do
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.down()
- end
- if turtle.detectDown() then
- turtle.digDown()
- end
- lDig(length)
- turtle.down()
- turn()
- else
- for i=1,count,1 do
- turtle.turnRight()
- for i=1,3,1 do
- while turtle.detectUp() do
- turtle.digUp()
- sleep(0.5)
- end
- turtle.up()
- end
- uDig(length)
- turn()
- for i=1,2,1 do
- if turtle.detectDown() then
- turtle.digDown()
- end
- turtle.down()
- end
- if turtle.detectDown() then
- turtle.digDown()
- end
- lDig(length)
- turtle.down()
- turtle.turnRight()
- for i=1,4,1 do
- turtle.forward()
- if turtle.detect() then
- print("Tunnel End,Aborting Branch process")
- return(0)
- end
- end
- end
- end
- print("Finished!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement