Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local StoneSlot = 1
- function refuel()
- local slot = StoneSlot + 1
- while ( turtle.getFuelLevel() < 100 and slot < 15 ) do
- slot = slot + 1
- turtle.select(slot)
- turtle.refuel(10)
- end
- turtle.select(1)
- end
- function tryForward()
- refuel()
- if (turtle.getFuelLevel() < 100 ) then
- print "Ran out of fuel!"
- os.exit()
- end
- return turtle.forward()
- end
- function tryUp()
- refuel()
- if (turtle.getFuelLevel() < 100 ) then
- print "Ran out of fuel!"
- os.exit()
- end
- while ( not turtle.up() ) do
- turtle.digUp()
- os.sleep(1)
- end
- end
- function checkSpace()
- if ( turtle.getItemCount(15) > 0 ) then
- print "Ran out of space!"
- os.exit()
- end
- end
- function checkSquare()
- turtle.select(StoneSlot)
- if ( turtle.compare() ) then return end
- while ( turtle.detect() ) do
- turtle.dig()
- end
- checkSpace()
- end
- function digWall()
- local hitEnd = false;
- repeat
- checkSquare()
- turtle.turnRight()
- if ( tryForward() ) then
- turtle.turnLeft()
- else
- hitEnd = true;
- end
- until ( hitEnd )
- end
- while ( turtle.detect() ) do
- for wall=1,4 do
- digWall()
- end
- tryUp()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement