Advertisement
SenpaiJody

Gordon Ramsitron 2

Oct 8th, 2022 (edited)
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.33 KB | None | 0 0
  1. --Croptia Supreme Pizza
  2.  
  3. local ingredientsName = "quark:variant_chest_2"
  4. local utensilsName = "quark:variant_chest_1"
  5. local resultStorageName = "quark:variant_chest_4"
  6. local turtleName = "turtle_1"
  7.  
  8. local crate = peripheral.wrap(ingredientsName)
  9. local utensils = peripheral.wrap(utensilsName)
  10. local resultStorage = peripheral.wrap(resultStorageName)
  11.  
  12. local invSlot = 1
  13.  
  14. rednet.open("top")
  15.  
  16. function craft()
  17.     rednet.send(3, "craft", "Gordon Ramsitron")
  18.     local msg
  19.     repeat
  20.         local sender, msg, prtc = rednet.receive("Gordon Ramsitron")
  21.         until msg == "done"
  22.     end
  23.  
  24. function clean()
  25.     rednet.send(3, "clean", "Gordon Ramsitron")
  26.     local msg
  27.     repeat
  28.         local sender, msg, prtc = rednet.receive("Gordon Ramsitron")
  29.         until msg == "done"
  30.     for i=1,16,1 do
  31.         returnUtensil(i)
  32.     end
  33. end
  34.  
  35.    
  36. function get(itemName)
  37.     local count = 0
  38.     for i = 1, crate.size(), 1 do
  39.         count = count+1
  40.         local item = crate.getItemDetail(i)
  41.         if item~= nil and item.name==itemName then
  42.             if item.count > 1 then        
  43.                 crate.pushItems(turtleName,i,1, invSlot)
  44.                 end
  45.             break
  46.             end
  47.         end
  48.     if invSlot ~= 3 and invSlot ~=7 and invSlot ~=9 then
  49.         invSlot = invSlot + 1
  50.         else
  51.         invSlot = invSlot + 2
  52.         end
  53.     end
  54. function returnItem(slot)
  55.     crate.pullItems(turtleName, slot)
  56.     invSlot = 1
  57.     end
  58. function getUtensil(itemName)
  59.     count = 0
  60.     for i = 1, utensils.size(), 1 do
  61.         count = count+1
  62.         local item = utensils.getItemDetail(i)
  63.         if item~= nil and item.name==itemName then    
  64.             utensils.pushItems(turtleName,i,1, invSlot)
  65.             break
  66.             end
  67.         end
  68.      if invSlot ~= 3 and invSlot ~=7 and invSlot ~=11 then
  69.         invSlot = invSlot + 1
  70.         else
  71.         invSlot = invSlot + 2
  72.         end
  73.     end
  74. function returnUtensil(slot)
  75.     utensils.pullItems(turtleName, slot)
  76.     invSlot = 1
  77.     end
  78.  
  79. function check(itemName)
  80.     local first = true
  81.     while true do
  82.         count = 0
  83.         for i = 1, crate.size(), 1 do
  84.             count = count+1
  85.             local item = crate.getItemDetail(i)
  86.             if item~= nil and item.name==itemName and item.count>1 then
  87.                 return true
  88.                 end
  89.             end
  90.         if first then
  91.             first = false
  92.             print("Waiting for "..itemName.."...")
  93.             end
  94.         end
  95.     end
  96.  
  97. function checkCompound(itemName)
  98.     for i = 1, crate.size(), 1 do
  99.         local item = crate.getItemDetail(i)
  100.         if item~= nil and item.name==itemName then
  101.             if item.count>1 then
  102.                 return true
  103.                 end
  104.             return false
  105.             end
  106.         end
  107.     return false
  108.     end
  109.  
  110.  
  111.  
  112. function craftFlour()
  113.     print("Crafting Flour...")
  114.     check("croptopia:oat")
  115.     get("croptopia:oat")
  116.     check("croptopia:oat")
  117.     get("croptopia:oat")
  118.     craft()
  119.     os.sleep(0.2)
  120.     returnItem(1)
  121.     end
  122.  
  123. function craftDough()
  124.     print("Crafting Dough...")
  125.     if not checkCompound("croptopia:flour") then
  126.       craftFlour()
  127.     end
  128.     check("croptopia:water_bottle")
  129.     getUtensil("croptopia:cooking_pot")
  130.     get("croptopia:flour")
  131.     get("croptopia:water_bottle")
  132.     craft()
  133.     os.sleep(0.2)
  134.     returnItem(2)
  135.     returnUtensil(1)
  136.     end
  137.    
  138. function craftTofu()
  139.     print("Crafting Tofu...")
  140.     check("croptopia:soybean")
  141.     check("croptopia:water_bottle")
  142.     getUtensil("croptopia:cooking_pot")
  143.     get("croptopia:water_bottle")
  144.     get("croptopia:soybean")
  145.     craft()
  146.     os.sleep(0.2)
  147.     returnItem(2)
  148.     returnUtensil(1)
  149.     end
  150.  
  151. function craftCheese()
  152.     print("Crafting Cheese...")
  153.     check("croptopia:salt")
  154.     check("croptopia:milk_bottle")
  155.     getUtensil("croptopia:cooking_pot")
  156.     get("croptopia:milk_bottle")
  157.     get("croptopia:salt")
  158.     os.sleep(0.2)
  159.     craft()
  160.     returnItem(2)
  161.     returnUtensil(1)
  162.     end
  163.  
  164.  
  165. function craftPizza()
  166.     print("Crafting Pizza...")
  167.     if not checkCompound("croptopia:dough") then
  168.       craftDough()
  169.     end
  170.     if not checkCompound("croptopia:cheese") then
  171.       craftCheese()
  172.     end
  173.     if not checkCompound("croptopia:tofu") then
  174.       craftTofu()
  175.     end
  176.     check("farmersdelight:tomato")
  177.     check("croptopia:bellpepper")
  178.     check("croptopia:olive")
  179.     getUtensil("croptopia:frying_pan")
  180.     get("croptopia:dough")
  181.     get("croptopia:cheese")
  182.     get("croptopia:tofu")
  183.     get("farmersdelight:tomato")
  184.     get("croptopia:bellpepper")
  185.     get("croptopia:olive")
  186.    
  187.     os.sleep(0.2)
  188.     craft()
  189.     returnItem(2)
  190.     returnUtensil(1)
  191.     print("Ding! Pizza Crafted!")
  192.     end
  193.    
  194. function work()
  195.     local count = 0
  196.     for i = 1, crate.size(), 1 do
  197.         count = count+1
  198.         local item = crate.getItemDetail(i)
  199.         if item~= nil and item.name=="harvestcraft:meatfeastpizzaitem" then
  200.             if item.count < 64 then        
  201.                 craftMeatFeastPizza()
  202.                 end
  203.             crate.pushItems("east",i,1)
  204.             break
  205.             end
  206.         end
  207.     end
  208.  
  209. clean()
  210. while true do
  211.     if crate.getItemDetail(11).count < 64 then
  212.         craftPizza()
  213.         crate.pushItems(resultStorageName, 11, crate.getItemDetail(11).count-1)
  214.         end
  215.        
  216.     os.sleep(0.05)
  217.     end
  218.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement