Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- args={...}
- local iterations=tonumber(args[1])
- if #args==0 then
- repeat
- io.write("Distance: ")
- iterations=tonumber(io.read())
- print("")
- until iterations~=nil and iterations>0
- end
- local function refill()
- if turtle.getItemCount(1)==0 then
- for i=2,16 do
- if turtle.getItemCount(i)~=0 then
- turtle.select(i)
- turtle.transferTo(1)
- turtle.select(1)
- end
- end
- end
- end
- oldTurtle={}
- oldTurtle.place=turtle.place
- oldTurtle.placeUp=turtle.placeUp
- oldTurtle.placeDown=turtle.placeDown
- oldTurtle.dig=turtle.dig
- oldTurtle.digUp=turtle.digUp
- oldTurtle.digDown=turtle.digDown
- turtle.place=function()
- refill()
- while not oldTurtle.place() and not turtle.detect() do
- turtle.attack()
- end
- end
- turtle.placeUp=function()
- refill()
- while not oldTurtle.placeUp() and not turtle.detectUp() do
- turtle.attackUp()
- end
- end
- turtle.placeDown=function()
- refill()
- while not oldTurtle.placeDown() and not turtle.detectDown() do
- turtle.attackDown()
- end
- end
- turtle.dig=function()
- while turtle.detect() and not oldTurtle.dig() do
- turtle.attack()
- end
- end
- turtle.digUp=function()
- while turtle.detectUp() and not oldTurtle.digUp() do
- turtle.attackUp()
- end
- end
- turtle.digDown=function()
- while turtle.detectDown() and not oldTurtle.digDown() do
- turtle.attackDown()
- end
- end
- for i=1,iterations do
- turtle.digDown()
- turtle.placeDown()
- turtle.digUp()
- turtle.turnLeft()
- turtle.dig()
- turtle.place()
- turtle.up()
- turtle.dig()
- turtle.place()
- turtle.turnRight()
- turtle.digUp()
- turtle.placeUp()
- turtle.turnRight()
- turtle.dig()
- turtle.place()
- turtle.down()
- turtle.dig()
- turtle.place()
- turtle.turnLeft()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement