Advertisement
k2green

Fusion auto crafting

Aug 29th, 2023 (edited)
940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.15 KB | Gaming | 0 0
  1. local rsBridge = peripheral.wrap("bottom")
  2. local reactor = peripheral.wrap("back")
  3. local dualStorage = peripheral.wrap("right")
  4. local singleStorage = peripheral.wrap("top")
  5.  
  6. local function isReactorReady(reactor)
  7.     return reactor.getItemDetail(1) == nil and reactor.getItemDetail(2) == nil
  8. end
  9.  
  10. local function hasSingleRecipe(singleStorage)
  11.     local details = singleStorage.getItemDetail(1)
  12.  
  13.     if details == nil then
  14.         return false
  15.     else
  16.         return details.count > 1
  17.     end
  18. end
  19.  
  20. local function hasDualRecipe(dualStorage)
  21.     return dualStorage.getItemDetail(1) ~= nil and dualStorage.getItemDetail(2) ~= nil
  22. end
  23.  
  24. while true do
  25.     while not isReactorReady(reactor) do
  26.         sleep(1)
  27.     end
  28.  
  29.     if hasSingleRecipe(singleStorage) then
  30.         while hasSingleRecipe(singleStorage) do
  31.             singleStorage.pushItems("back", 1, 1, 1)
  32.             singleStorage.pushItems("back", 1, 1, 2)
  33.         end
  34.     elseif hasDualRecipe(dualStorage) then
  35.         while hasDualRecipe(dualStorage) do
  36.             dualStorage.pushItems("back", 1, 1, 1)
  37.             dualStorage.pushItems("back", 2, 1, 2)
  38.         end
  39.     end
  40. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement