Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local REG_TRACK_COUNT = 37
- local POWER_TRACK_COUNT = 1
- local rt = 1
- local pt = 2
- local totalDistance = 0
- if #arg == 1 then
- totalDistance = tonumber(arg[1])
- else
- print("Please give total count of track iterations to lay so I don't go on forever.")
- end
- function regTrack()
- turtle.select(rt)
- for i = 1, REG_TRACK_COUNT do
- if turtle.detect() == true then
- print("regTrack: Block in the way")
- return false
- else
- print("regTrack: moving forward.")
- turtle.forward()
- print("regTrack: laying track.")
- turtle.placeDown(1)
- end
- end
- return true
- end
- function powTrack()
- turtle.select(pt)
- for i = 1, POWER_TRACK_COUNT do
- if turtle.detect() == true then
- print("powTrack: Block in the way")
- return false
- else
- print("powTrack: moving forward.")
- turtle.forward()
- print("powTrack: laying track.")
- turtle.placeDown(1)
- end
- end
- return true
- end
- turtle.up()
- for i=1, totalDistance do
- if regTrack() == true then
- print("Layed reg track set.")
- if powTrack() == true then
- print("Layed power track set.")
- else
- print("Power track error.")
- end
- else
- print("Reg track error.")
- end
- end
Add Comment
Please, Sign In to add comment