Advertisement
Guest User

mine

a guest
Mar 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.01 KB | None | 0 0
  1. --prints true if inventory is full, else false
  2. function isFull()
  3.   for i=3, 16 do
  4.     if turtle.getItemCount(i) == 0 then
  5.       return false
  6.     elseif i == 16 then
  7.       return true
  8.     end
  9.   end
  10. end
  11.  
  12. function emptyInventory()
  13.   if isFull() == false then
  14.     return
  15.   end
  16.  
  17.   betterRefuel()
  18.  
  19.   turtle.select(2)
  20.   turtle.placeDown()
  21.   for i = 3, 16 do
  22.     turtle.select(i)  
  23.     turtle.dropDown(64)
  24.   end
  25.  
  26.   turtle.select(2)
  27.   turtle.digDown()
  28. end
  29.  
  30. --uses all fuel in inventory, up to 48 items
  31. function betterRefuel()
  32.   for i = 3, 16 do
  33.     turtle.select(i)
  34.     turtle.refuel(48)
  35.   end
  36.   turtle.select(2)
  37. end
  38.  
  39. --moves forward but also digs
  40. function betterMove()
  41.   turtle.dig()
  42.   turtle.forward()
  43.   turtle.digUp()
  44.   turtle.digDown()
  45.   emptyInventory()
  46. end
  47.  
  48. function farmLine(n)
  49.   for i=1, n do
  50.     betterMove()
  51.   end
  52. end
  53.  
  54. function right()
  55.   turtle.turnRight()
  56.   betterMove()
  57.   turtle.turnRight()
  58. end
  59.  
  60. function left()
  61.   turtle.turnLeft()
  62.   betterMove()
  63.   turtle.turnLeft()
  64. end
  65.  
  66. function placeLoaderUp()
  67.   turtle.digUp()
  68.   turtle.select(1)
  69.   turtle.placeUp()
  70. end
  71.  
  72. function placeLoader()
  73.   turtle.dig()
  74.   turtle.select(1)
  75.   turtle.place()
  76. end
  77.  
  78. function firstThreeLines()
  79.   farmLine(15)
  80.   placeLoaderUp()
  81.   turtle.turnRight()
  82.   farmLine(15)
  83.   turtle.turnRight()
  84.   farmLine(15)
  85. end
  86.  
  87. function remainingLines()
  88.   for i = 1, 14 do
  89.     if i%2 == 1 then
  90.       right()
  91.     else
  92.       left()
  93.     end
  94.   end
  95. end
  96.  
  97. function reAlign()
  98.   turtle.turnRight()
  99.   betterMove()
  100.   turtle.turnRight()
  101.   for i=1, 15 do
  102.     turtle.forward()
  103.   end
  104. end
  105.  
  106. function transition()
  107.   turtle.turnRight()
  108.   placeLoader()
  109.   turtle.turnLeft()
  110.   turtle.digUp()
  111.   turtle.up()
  112.   turtle.dig()
  113.   placeLoader()
  114.   turtle.down()
  115.   turtle.forward()
  116.   turtle.turnRight()
  117.   betterMove()
  118.   turtle.turnRight()
  119.   turtle.dig()
  120.   turtle.turnRight()
  121.   turtle.forward()
  122.   turtle.turnRight()
  123. end
  124.  
  125. --firstThreeLines()
  126. --remainingLines()
  127. --reAlign()
  128. --transition()
  129. emptyInventory()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement