Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Revision History
- -- 20140804 Initial draft, untested
- -- 20140811 update based on initial testing, turtle.compare() doesn't seem to recognize pipes but does recognize dirt/sand
- -- so loops will just have to detect that "something" is there that's not whatever surrounds the pipes...i.e.
- -- stone, slab, sand...(as those are the three main things I run pipe through), I'm in total pipe recovery mode
- -- at this point as tesseracts are now replacing the long pipe runs...
- -- Purpose/intro:
- -- pipes all over looking unsightly? the goal of this is to follow a pipe and pick them back up.
- -- place pipe to reclaim in slot 1, position turtle directly in front of pipe to reclaim.
- -- turtle will start off picking up the pipe, once it doesn't detect a pipe it will attempt to turn to re-acquire the pipe
- -- in the event no pipe is to either side, above, or below it, it will stop. (possibly eventually returning to the start)
- -- select object to not reclaim (stone, iron tank wall, etc.)
- turtle.select(16)
- -- while block in front, grab pipe, move forward
- -- position turtle in front of first pipe
- while not turtle.compare() do
- if not turtle.forward()
- turtle.dig()
- turtle.forward()
- end
- -- after move, detect either a don't acquire block or nothing then look around
- if turtle.compare() or not turtle.detect() then
- turtle.turnRight()
- -- No pipe to right, check to left.
- if not turtle.compare() then
- turtle.turnLeft()
- turtle.turnLeft()
- -- We know no pipe behind us, so pipe above? If so, get it.
- if not turtle.compare() then
- if turtle.compareUp() then
- while turtle.compareUp() do
- turtle.digUp()
- turtle.up()
- end
- end
- -- if not, pipe below? If so, get it.
- if turtle.compareDown() then
- while turtle.compareDown() do
- turtle.digDown()
- turtle.down()
- end
- end
- -- in case we moved up or down, attempt to re-acquire pipe 360 degrees.
- if not turtle.compare() then
- turtle.turnRight()
- end
- if not turtle.compare() then
- turtle.turnRight()
- end
- if not turtle.compare() then
- turtle.turnRight()
- end
- if not turtle.compare() then
- turtle.turnRight()
- end
- -- here we should either be facing a pipe, or struck out 4 times, in which case it's time to end.
- end
- end
- end
- end
- -- FIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement