ShivaFang

Untitled

Sep 7th, 2013
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local h = 1
  2. local fuelSlot = 1
  3. local stonePlace = 5
  4. local glassPlace = 9
  5.  
  6. local blanks = 0
  7.  
  8. function filler()
  9.  if turtle.getFuelLevel()<10 then
  10.   turtle.select(fuelSlot)
  11.   turtle.refuel(1)
  12.  end
  13.  if turtle.getItemCount(stonePlace)<2 then
  14.   stonePlace = stonePlace + 1
  15.  end  
  16.  
  17.  if turtle.getItemCount(glassPlace )<2 then
  18.   glassPlace = glassPlace + 1
  19.  end  
  20.  
  21. function digMove()
  22.  turtle.down()
  23.  turtle.digDown()
  24. end
  25.  
  26. function digToBedrock()
  27.  turtle.digDown()
  28.  while not turtle.detectDown() do
  29.   filler()
  30.   digMove()
  31.  end
  32. end
  33.  
  34. function checkForward()
  35.   turtle.select(glassPlace)
  36.   if (not turtle.detect()) or (turtle.compare()) then
  37.     blanks = blanks + 1
  38.   end
  39. end
  40.  
  41. function placeWhat()
  42.   blanks = 0
  43.   checkForward()
  44.   turtle.turnLeft()
  45.   checkForward()
  46.   turtle.turnRight()
  47.   turtle.turnRight()
  48.   checkForward()
  49.   turtle.turnLeft()
  50.   if (blanks == 0) then
  51.    turtle.select(stonePlace)
  52.   else
  53.     turtle.select(glassPlace)
  54.   end
  55. end
  56.  
  57. function movePlace()
  58.  if turtle.up() then
  59.   turtle.placeDown()
  60.   h = h + 1
  61.  else
  62.   turtle.digUp()
  63.  end
  64. end
  65.  
  66. function run()
  67.   digToBedrock()
  68.  
  69.   while h < 123 do
  70.    filler()
  71.    if h < 70 then
  72.      placeWhat()
  73.    else
  74.      turtle.select(stonePlace)
  75.    end
  76.    movePlace()
  77.   end
  78. end
  79.  
  80. run()
Advertisement
Add Comment
Please, Sign In to add comment