ShivaFang

Untitled

Sep 9th, 2013
85
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. end
  21.  
  22. function digMove()
  23.  turtle.down()
  24.  turtle.digDown()
  25. end
  26.  
  27. function digToBedrock()
  28.  turtle.digDown()
  29.  while not turtle.detectDown() do
  30.   filler()
  31.   digMove()
  32.  end
  33. end
  34.  
  35. function checkForward()
  36.   turtle.select(glassPlace)
  37.   if (not turtle.detect()) or (turtle.compare()) then
  38.     blanks = blanks + 1
  39.   end
  40. end
  41.  
  42. function placeWhat()
  43.   blanks = 0
  44.   checkForward()
  45.   turtle.turnLeft()
  46.   checkForward()
  47.   turtle.turnRight()
  48.   turtle.turnRight()
  49.   checkForward()
  50.   turtle.turnLeft()
  51.   if (blanks == 0) then
  52.    turtle.select(stonePlace)
  53.   else
  54.     turtle.select(glassPlace)
  55.   end
  56. end
  57.  
  58. function movePlace()
  59.  if turtle.up() then
  60.   turtle.placeDown()
  61.   h = h + 1
  62.  else
  63.   turtle.digUp()
  64.  end
  65. end
  66.  
  67. function run()
  68.   digToBedrock()
  69.  
  70.   while h < 123 do
  71.    filler()
  72.    if h < 70 then
  73.      placeWhat()
  74.    else
  75.      turtle.select(stonePlace)
  76.    end
  77.    movePlace()
  78.   end
  79. end
  80.  
  81. run()
Advertisement
Add Comment
Please, Sign In to add comment