Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- pastebin get Xr2JU3p8 breakBox
- print("Put an item for me to detect in slot #1.")
- print("Put coal in slot #16.")
- print("Type 'Start' when ready")
- local go = io.read()
- local selected = 1
- local fuel = 16
- --[[
- * Check to see if refueling is needed
- ]]
- local function ifRefuel()
- if turtle.getFuelLevel() < 1 then
- turtle.select(fuel)
- turtle.refuel(1)
- turtle.select(selected)
- end
- end
- if go == "Start" then
- -- Select the starting cell
- turtle.select(selected)
- while true do
- ifRefuel()
- if turtle.compare() then
- -- Block detected
- turtle.dig()
- turtle.forward()
- else
- -- Look around
- turtle.turnLeft()
- if turtle.compare() then
- -- Found the next path; Continue
- turtle.dig()
- turtle.forward()
- else
- turtle.turnRight()
- turtle.turnRight()
- if turtle.compare() then
- turtle.dig()
- turtle.forward()
- else
- -- We're done!
- break
- end
- end
- end
- end
- print("Done!")
- else
- print("Terminating")
- return
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement