ShivaFang

Untitled

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