Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Updated to work with a later version of computer craft.
- -- Now creates flooring when there isn't any.
- near=true
- blocksTravelled = 0
- function detectLava()
- while not turtle.up() do
- turtle.digUp()
- end
- for i=0, 1, 1 do
- if not turtle.detectUp() then
- if turtle.digUp() then
- turtle.placeUp()
- end
- end
- turtle.turnLeft()
- if not turtle.detect() then
- if turtle.dig() then
- turtle.place()
- end
- end
- turtle.turnRight()
- turtle.turnRight()
- if not turtle.detect() then
- if turtle.dig() then
- turtle.place()
- end
- end
- turtle.turnLeft()
- if i == 0 then
- turtle.down()
- end
- end
- end
- function mine(num)
- for i=0, num, 1 do
- if not turtle.detectDown() do
- turtle.select(1)
- turtle.placeDown()
- end
- while turtle.detectUp() do
- turtle.digUp()
- end
- while turtle.detect() do
- turtle.dig()
- end
- while not turtle.forward() do
- turtle.dig()
- end
- detectLava()
- end
- end
- function checkInventory()
- if turtle.getItemCount(12) > 0 then
- dropOff()
- end
- end
- function dropOff()
- turtle.turnRight()
- turtle.turnRight()
- for i=0, (blocksTravelled - 1), 1 do
- turtle.forward()
- end
- if not near then
- turtle.turnLeft()
- for i=0, 16, 1 do
- turtle.forward()
- end
- turtle.turnRight()
- end
- sleep(10)
- turtle.turnRight()
- turtle.turnRight()
- if not near then
- turtle.turnLeft()
- for i=0, 16, 1 do
- turtle.forward()
- end
- turtle.turnRight()
- end
- for i=0, blocksTravelled - 1, 1 do
- turtle.forward()
- end
- end
- function segment(mirror)
- turn = function() error("Turn not being assigned") end
- reverseTurn = function() error("ReverseTurn not being assigned") end
- if mirror == true then
- turn = turtle.turnRight
- reverseTurn = turtle.turnLeft
- else
- turn = turtle.turnLeft
- reverseTurn = turtle.turnRight
- end
- turn()
- mine(16)
- near = not near
- turn()
- mine(2)
- reverseTurn()
- reverseTurn()
- mine(5)
- blocksTravelled = blocksTravelled + 3
- checkInventory()
- end
- for i=0, 10, 1 do
- segment(false)
- segment(true)
- end
Advertisement
Add Comment
Please, Sign In to add comment