FreetheFr0gs

Quarry Drill Head Auto-Craft

Apr 8th, 2024 (edited)
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.56 KB | None | 0 0
  1. -- Load Chest w/ 16+ Ingots
  2. -- Suck 11 Ingots > Place them in compressor (Down)      Creates 11 Plates
  3. -- Suck 5 Ingots > Place in Cutter (Up)              Creates 10 Rods
  4. --
  5. -- Suck All Plates > Put 2 Plates back into Compressor   Creates 2 Curved Plates
  6. -- Suck All Rods > Put 6 back into cutter                Creates 12 Bolts
  7. -- (Wait 10 Seconds) Suck Curved Plates
  8. -- Put 2 Rods into Compressor                            Creates 2 Rings
  9. --
  10. --
  11.  
  12. local craftTime
  13. function ingotChecker()
  14.     turtle.select(1)
  15.     turtle.suck(16)
  16.     ingotCount = turtle.getItemCount(1)
  17.     if (ingotCount < 16) then
  18.        print("Insufficient Ingots")
  19.        turtle.turnLeft()
  20.        turtle.drop()
  21.        turtle.turnRight()
  22.        sleep(10)
  23.     else
  24.         data = turtle.getItemDetail()
  25.         if (data.name == "minecraft:iron_ingot") then --Iron Gears
  26.             craftTime = 2
  27.             partsMaker()
  28.             gearMaker()
  29.             turtle.turnRight()
  30.             turtle.drop()
  31.             turtle.turnRight()
  32.             turtle.turnRight()
  33.         elseif (data.name == "techreborn:bronze_ingot") then --Bronze Drill Head
  34.             craftTime = 1
  35.             partsMaker()
  36.             gearMaker()
  37.             drillHeadMaker()
  38.         elseif (data.name == "techreborn:steel_ingot") then --Steel Gears
  39.             craftTime = 2
  40.             partsMaker()
  41.             gearMaker()
  42.             turtle.turnRight()
  43.             turtle.drop()
  44.             turtle.turnRight()
  45.             turtle.turnRight()
  46.         else
  47.             print("Item does not match recognized ingots")
  48.             turtle.turnLeft()
  49.             turtle.drop()
  50.             turtle.turnRight()
  51.         end
  52.     end
  53. end
  54.  
  55. function partsMaker()
  56.         turtle.dropDown(11)
  57.         turtle.dropUp(5)
  58.         sleep(30*craftTime)                 --Lets cutting machine crafts finish
  59.         turtle.suckUp()             --Suck 10 Rods
  60.         turtle.dropUp(6)            --6 Rods back in cutting machine for 12 Bolts
  61.         turtle.transferTo(15,2)     --Places 2 "final rods" in slot 15
  62.         turtle.transferTo(10,2)     --Places 2 "working rods" in slot 10 to be used later
  63.         sleep(30*craftTime)                     --Lets both machines finish
  64.         turtle.suckDown()           --Suck 11 Plates
  65.         if (data.name == "techreborn:bronze_ingot") then
  66.         turtle.dropDown(2)          --Places 2 plates back in compressor for curved plates
  67.         end
  68.         turtle.transferTo(16)       --Places 9 (11-2) normal plates in slot 16
  69.         turtle.suckUp()             --Sucks 12 Bolts
  70.         turtle.transferTo(14)       --Moves bolts to slot 14
  71.         if (data.name == "techreborn:bronze_ingot") then
  72.         sleep(10*craftTime)
  73.         turtle.suckDown()           --Suck 2 Curved Plates
  74.         turtle.transferTo(13)       --Moved Curved Plates to Slot 12
  75.         end
  76.         turtle.select(10)           --Select "working rods" in slot 10
  77.         turtle.dropDown()           --Places 2 rods in compressor for rings
  78.         sleep(10*craftTime)
  79.         turtle.select(12)
  80.         turtle.suckDown()           --Places 2 Rings in slot 13
  81.        
  82.         sleep(1)
  83.  
  84.         --All "Base parts" should be completed
  85. end --partsMaker
  86.    
  87. function gearMaker() --Makes 2 Gears
  88.     turtle.select(16) --Plates
  89.         turtle.transferTo(1, 2)
  90.         turtle.transferTo(3, 2)
  91.         turtle.transferTo(9, 2)
  92.         turtle.transferTo(11,2)
  93.    
  94.     turtle.select(14) --Bolts
  95.         turtle.transferTo(2, 2)
  96.         turtle.transferTo(5, 2)
  97.         turtle.transferTo(7, 2)
  98.         turtle.transferTo(10,2)
  99.    
  100.     turtle.select(12) --Rings
  101.         turtle.transferTo(6, 2)
  102.     --All Parts Should be in place for craft
  103.     --Need to remove excess parts/parts used later
  104.  
  105.     turtle.select(14)
  106.     turtle.drop(1) --Drops "extra" bolt
  107.     turtle.select(15)
  108.     turtle.drop(1) --Drops "extra" rod
  109.    
  110.     --Moves Parts used later into temporary storage unit
  111.     turtle.turnRight()
  112.     turtle.select(16)
  113.     turtle.drop()
  114.     turtle.select(15)
  115.     turtle.drop()
  116.     turtle.select(14)
  117.     turtle.drop()
  118.     turtle.select(13)
  119.     turtle.drop()
  120.    
  121.     --Craft 2 Gears
  122.     turtle.craft(2)
  123.     sleep(1)
  124. end
  125.  
  126. function drillHeadMaker()
  127.     --Moves Gears to slots 15/10
  128.     turtle.transferTo(15, 1)
  129.     turtle.transferTo(10,1)
  130.     turtle.select(1)
  131.    
  132.     turtle.suck() --Grabs plate
  133.     turtle.transferTo(8, 1)
  134.    
  135.     turtle.suck() --Grabs Rod
  136.     turtle.transferTo(11.1)
  137.    
  138.     turtle.suck() --Grabs Bolts
  139.     turtle.transferTo(6, 1)
  140.     turtle.transferTo(14, 1)
  141.     turtle.transferTo(16, 1)
  142.    
  143.     turtle.suck() --Grabs Curved Plates
  144.     turtle.transferTo(7, 1)
  145.     turtle.transferTo(12,1)
  146.    
  147.     turtle.craft(1)
  148.     turtle.turnRight()
  149.     turtle.drop()
  150.     turtle.turnRight()
  151.     turtle.turnRight()
  152. end
  153.  
  154. while true do
  155.     ingotChecker()
  156. end
  157.  
  158.  
  159.        
Add Comment
Please, Sign In to add comment