Advertisement
Guest User

alan

a guest
Feb 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | None | 0 0
  1. global direction =
  2.  
  3. function forwd (times)
  4.   for i=1, times do
  5.     if turtle.forward() then
  6.       --just go
  7.     else
  8.       turtle.dig()
  9.       turtle.forward()
  10.     end
  11.   end
  12. end
  13.  
  14. function turnAround()
  15.   turtle.turnLeft()
  16.   turtle.turnLeft()
  17. end
  18.  
  19. function circle ()
  20.   turtle.digDown()
  21.   turtle.down()
  22.   forwd(4)
  23.   turtle.turnLeft()
  24.   direction = 'E'
  25.   forwd(1)
  26.   turtle.turnLeft(1)
  27.   direction = 'N'
  28.   forwd(4)
  29.   turtle.turnLeft()
  30.   direction = 'W'
  31.   forwd(1)
  32.   turtle.turnLeft()
  33.   direction = 'S'
  34. end
  35.  
  36. function ascend ()
  37.   local surfaced = false
  38.   local hitBottom = false
  39.   local moving = true
  40.  
  41.   turtle.up()
  42.   if direction == 'S' then
  43.     turnAround()
  44.     while moving == true do
  45.       moving = turtle.forward()
  46.   else if direction == 'E' then
  47.   else if direction == 'N' then
  48.   else if direction == '
  49.  while surfaced ~= true do
  50.    local isBlock, type =  turtle.inspect()
  51.    print (type.name)
  52.    if type.name == 'minecraft:chest' or isBlock == false then
  53.      surfaced = true
  54.      print (type.name, isBlock, "breaking?")
  55.      break
  56.    else
  57.      turtle.up()
  58.    end
  59.  end
  60.  for i=1, 16 do
  61.    turtle.drop()
  62.  end
  63.  turtle.select(1)
  64.  
  65.  turnAround()
  66.  while hitBottom == false do
  67.    hitBottom = turtle.down()
  68.  end
  69. end
  70.  
  71. function checkInv ()
  72.  if turtle.getItemCount(16) > 0 then
  73.    ascend()
  74.  end
  75. end
  76.  
  77. --Main Program
  78.  
  79.  
  80. for i=1, 75 do
  81.  checkInv()
  82.  circle()
  83. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement