Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chests = peripheral.wrap("bottom")
- local recipes =
- {
- Mutandis = {"Mandrake Root", "Exhale of the Horned One", "Egg"},
- Mutandis_Extremis = {"Nether Wart", "Mutandis"},
- Otherwhere_Chalk = {"Nether Wart", "Tear of the Goddess", "Ender Pearl", "Ritual Chalk"},
- Infernal_Chalk = {"Nether Wart", "Blaze Powder", "Ritual Chalk"},
- Golden_Chalk = {"Mandrake Root", "Gold Nugget", "Ritual Chalk"},
- Drop_of_Luck = {"Mandrake Root", "Nether Wart", "Tear of the Goddess", "Refined Evil", "Mutandis Extremis"}
- }
- local items_left = {}
- local items_right = {}
- local FoundRecipe = {false, "N/A"}
- local interval =
- {
- Mutandis = 8,
- Mutandis_Extremis = 8,
- Otherwhere_Chalk = 30,
- Infernal_Chalk = 20,
- Golden_Chalk = 20,
- Drop_of_Luck = 44, --halved
- SystemReboot = 16
- }
- local Error_left = true
- function CheckIfExists(query, Table)
- local Exists = false
- for key, value in pairs(Table) do
- if(query == value) then
- Exists = true
- break
- end
- end
- return Exists
- end
- for i=1, 10 do
- if(type(chests.callRemote("tile_extrautils_chestfull_name_4","getStackInSlot",i)) ~= "nil") then
- items_left[#items_left + 1] = chests.callRemote("tile_extrautils_chestfull_name_4", "getStackInSlot",i).display_name
- end
- end
- for i=1, 10 do
- if(type(chests.callRemote("tile_extrautils_chestfull_name_5","getStackInSlot",i)) ~= "nil") then
- items_right[#items_right + 1] = chests.callRemote("tile_extrautils_chestfull_name_5","getStackInSlot",i).display_name
- end
- end
- for product, list in pairs(recipes) do
- --print(product.." | "..tostring(#items))
- FoundRecipe[1] = true
- FoundRecipe[2] = product
- if(#items_left == #list) then
- for i=1, #items_left do
- FoundRecipe[1] = FoundRecipe[1] and CheckIfExists(items_left[i], list)
- --print(items_left[i].." | "..tostring(CheckIfExists(items_left[i], list)))
- end
- end
- if(FoundRecipe[1] == true) and (#items_left == #list) then
- print("Left chest: Found recipe - "..FoundRecipe[2])
- sleep(0.5)
- print("Transfering items..")
- rs.setAnalogOutput("left",14)
- for i=1, #items_left do
- chests.callRemote("tile_extrautils_chestfull_name_4","pushItemIntoSlot","EAST",i,1,i)
- --chest.pushItemIntoSlot("EAST",i,1,i)
- sleep(0.2)
- end
- sleep(2)
- rs.setAnalogOutput("left",0)
- sleep(interval[FoundRecipe[2]])
- Error_left = false
- break
- end
- end
- if(Error_left) then
- print("Left chest: No valid recipe found!")
- end
- local FoundRecipe = {false, "N/A"}
- for product, list in pairs(recipes) do
- --print(product.." | "..tostring(#items))
- FoundRecipe[1] = true
- FoundRecipe[2] = product
- if(#items_right == #list) then
- for i=1, #items_right do
- FoundRecipe[1] = FoundRecipe[1] and CheckIfExists(items_right[i], list)
- --print(items_right[i].." | "..tostring(CheckIfExists(items_right[i], list)))
- end
- end
- if(FoundRecipe[1] == true) and (#items_right == #list) then
- print("Right chest: Found recipe - "..FoundRecipe[2])
- sleep(0.5)
- print("Transfering items..")
- rs.setAnalogOutput("right",14)
- for i=1, #items_right do
- chests.callRemote("tile_extrautils_chestfull_name_5","pushItemIntoSlot","EAST",i,1,i)
- --chest.pushItemIntoSlot("EAST",i,1,i)
- sleep(0.2)
- end
- sleep(2)
- rs.setAnalogOutput("right",0)
- sleep(interval[FoundRecipe[2]])
- os.reboot()
- end
- end
- print("Right chest: No valid recipe found!")
- sleep(interval.SystemReboot)
- os.reboot()
- --local chest_left = peripheral.wrap("left")
- --for k,v in pairs(chest_left) do
- -- print(tostring(k).." | "..tostring(v))
- --end
- --chest_left.callRemote(
- --"tile_extrautils_chestfull_name_3",
- --"pushItemIntoSlot","EAST",1,1,1)
- --print(CheckIfExists("Eg",recipes.Mutandis))
- --for k,v in pairs(items) do
- --print(k.." | "..v)
- --end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement