edoreld

Untitled

Nov 13th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.03 KB | None | 0 0
  1. cleanGoldSlot= 5
  2. dirtyGoldSlot= 6
  3. goldOreSlot = 7
  4. reducedGoldChunksSlot = 8
  5. emptyBucketSlot = 13
  6. sludge = 14
  7. filledBucketSlot = 15
  8.  
  9. function compare()  
  10.    
  11.     turtle.select(1)
  12.  
  13.     if turtle.compareTo(cleanGoldSlot) then
  14.         turtle.transferTo(cleanGoldSlot,64)
  15.     elseif turtle.compareTo(emptyBucketSlot) then
  16.         turtle.transferTo(emptyBucketSlot,64)
  17.     elseif turtle.compareTo(sludge) then
  18.         turtle.transferTo(sludge,64)
  19.     elseif turtle.compareTo(dirtyGoldSlot) then
  20.         turtle.dropDown()
  21.     end
  22. end
  23.  
  24. function fillBucket()
  25.     if turtle.getItemCount(emptyBucketSlot) > 1 then
  26.         turtle.select(emptyBucketSlot)
  27.         turtle.forward()
  28.         turtle.placeDown()
  29.         turn180()
  30.         turtle.forward()
  31.         turn180()
  32.         turtle.select(1)
  33.     end
  34. end
  35.  
  36. function supplyBucket()
  37.     if turtle.getItemCount(filledBucketSlot) == 1 then
  38.         turtle.select(filledBucketSlot)
  39.         turtle.dropDown()
  40.         turtle.select(1)
  41.     end
  42. end
  43.  
  44. function moveToSlagFurnace()
  45.     turn180()
  46.     for i=1,2 do
  47.         turtle.forward()
  48.     end
  49. end
  50.  
  51. function moveToSlagFurnaceOutput()
  52.     moveToSlagFurnace()
  53.     turtle.turnLeft()
  54.     turtle.forward()
  55.     turtle.down()
  56.     turn180()
  57. end
  58.  
  59. function resetPositionFromSlagFurnaceOutput()
  60.     turtle.up()
  61.     turtle.forward()
  62.     turtle.turnRight()
  63.     for i=1,2 do
  64.         turtle.forward()
  65.     end
  66. end
  67.  
  68. function resetPositionFromSlagFurnace()
  69.     turn180()
  70.     for i=1,2 do
  71.         turtle.forward()
  72.     end
  73. end
  74.  
  75. function deliverCleanChunks()
  76.     moveToSlagFurnace()
  77.     turtle.select(cleanGoldSlot)
  78.     while turtle.getItemCount(cleanGoldSlot) > 1 do
  79.         turtle.dropDown(1)
  80.     end
  81.     resetPositionFromSlagFurnace()
  82.     turtle.select(1)
  83. end
  84.  
  85. function turn180()
  86.     for i=1,2 do
  87.         turtle.turnLeft()
  88.     end
  89. end
  90.  
  91. function moveToMixerOutput()
  92.     turtle.forward()
  93.     turtle.down()
  94.     turn180()
  95. end
  96.  
  97. function resetPositionFromMixerOutput()
  98.     turtle.up()
  99.     turtle.forward()
  100.     turn180()
  101. end
  102.  
  103. function grabChestContents()
  104.     if turtle.getItemCount(goldOreSlot) == 0 then
  105.         turtle.select(goldOreSlot)
  106.         turtle.turnLeft()
  107.         turtle.suck(64)
  108.         turtle.turnRight()
  109.         turtle.select(1)
  110.     end
  111. end
  112.  
  113. function goToGrinderInput()
  114.     turn180()
  115.     turtle.forward()
  116. end
  117.  
  118. function resetPositionFromGrinderInput()
  119.     turn180()
  120.     turtle.forward()
  121. end
  122.  
  123. function deployOreInGrinder()
  124.     turtle.select(goldOreSlot)
  125.     turtle.dropDown()
  126.     turtle.select(1)
  127. end
  128.  
  129. function goToGrinderOutput()
  130.     turn180()
  131.     turtle.forward()
  132.     turtle.turnLeft()
  133.     turtle.forward()
  134.     turtle.down()
  135.     turn180()
  136. end
  137.  
  138. function resetPositionFromGrinderOutput()
  139.     turtle.up()
  140.     turtle.forward()
  141.     turtle.turnRight()
  142.     turtle.forward()
  143. end
  144.  
  145. function grabContentsFromGrinderOutput()
  146.     goToGrinderOutput()
  147.     turtle.select(dirtyGoldSlot)
  148.     turtle.suck()
  149.     turtle.select(1)
  150.     resetPositionFromGrinderOutput()
  151. end
  152.  
  153. function grabContentsFromSlagFurnaceOutput()
  154.     moveToSlagFurnaceOutput()
  155.     turtle.select(reducedGoldChunksSlot)
  156.     turtle.suck()
  157.     resetPositionFromSlagFurnaceOutput()   
  158.     turtle.select(1)
  159. end
  160.  
  161. function moveToCrystalInput()
  162.     turn180()
  163.     for i=1,4 do
  164.         turtle.forward()
  165.     end
  166.     turtle.turnLeft()
  167.     turtle.forward()
  168.     turtle.down()
  169.     turn180()
  170. end
  171.  
  172. function resetPositionFromCrystalInput()
  173.     turtle.up()
  174.     turtle.forward()
  175.     turtle.turnRight()
  176.     for i=1,4 do
  177.         turtle.forward()
  178.     end
  179. end
  180.  
  181. function deployToCrystal()
  182.     moveToCrystalInput()
  183.     turtle.select(reducedGoldChunksSlot)
  184.     turtle.dropDown()
  185.     turtle.select(1)
  186.     resetPositionFromCrystalInput()
  187. end
  188.  
  189. function deployDirtyGold()
  190.     turtle.select(dirtyGoldSlot)
  191.     turtle.dropDown()
  192.     turtle.select(1)
  193. end
  194.  
  195.  
  196. while 0 == 0 do
  197.     turtle.select(1)
  198.     grabChestContents()
  199.     goToGrinderInput()
  200.     deployOreInGrinder()
  201.     resetPositionFromGrinderInput()
  202.     moveToMixerOutput()
  203.     turtle.select(1)
  204.     for i=1,4 do
  205.         turtle.suck()
  206.         compare()
  207.     end
  208.     resetPositionFromMixerOutput()
  209.     fillBucket()
  210.     supplyBucket()
  211.     if turtle.getItemCount(cleanGoldSlot) > 1 then
  212.         deliverCleanChunks()
  213.     end
  214.    
  215.     grabContentsFromGrinderOutput()
  216.  
  217.     grabContentsFromSlagFurnaceOutput()
  218.     deployDirtyGold()
  219.  
  220.     moveToCrystalInput()
  221.     turtle.select(reducedGoldChunksSlot)
  222.     turtle.drop()
  223.     turtle.select(1)
  224.     resetPositionFromCrystalInput()
  225.  
  226.  
  227.     os.sleep(1)
  228. end
Advertisement
Add Comment
Please, Sign In to add comment