Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function scheduleHomeRun()
- refuelScheduled = true
- end
- function refuel()
- if turtle.getFuelLevel == "unlimited" then return true end
- if turtle.getFuelLevel() < 50 then
- turtle.select(5)
- turtle.refuel(1)
- if turtle.getItemCount(5) == 0 then scheduleHomeRun() end
- end
- end
- function goStraight()
- while turtle.detect() == false do
- turtle.forward()
- refuel()
- end
- end
- refuelScheduled = false
- function replace()
- turtle.digDown()
- turtle.select(4)
- turtle.placeDown()
- turtle.select(3)
- end
- function digRow()
- while turtle.detect() == false do
- turtle.forward()
- refuel()
- turtle.select(3)
- if turtle.compareDown() then
- replace()
- end
- end
- end
- function findHome()
- goStraight()
- turtle.select(1)
- if turtle.compare() then
- turtle.turnRight()
- goStraight()
- turtle.turnRight()
- else
- turtle.turnLeft()
- goStraight()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- function doRoute()
- while true do
- digRow()
- turtle.turnRight()
- turtle.forward()
- refuel()
- turtle.turnRight()
- goStraight()
- turtle.turnLeft()
- turtle.forward()
- refuel()
- if turtle.detect() then
- findHome()
- turtle.turnLeft()
- turtle.turnLeft()
- turtle.select(3)
- turtle.drop(turtle.getItemCount(3)-1)
- turtle.select(4)
- turtle.suck()
- turtle.turnLeft()
- turtle.turnLeft()
- else
- turtle.turnLeft()
- end
- end
- end
- findHome()
- while true do
- doRoute()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement