Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- items = {
- "plate",
- "sheet",
- "paper"
- }
- machine = "create:depot_0"
- wormhole = "occultism:stable_wormhole_5"
- if fs.exists("API") == false then
- shell.run("pastebin", "get", "EzkfU5ZM", "API")
- end
- shaka = require("API")
- if fs.exists("targetInv") then
- local file = fs.open("targetInv", "r")
- storage = file.readAll()
- file.close()
- else
- storage = ""
- end
- lastMoved = {}
- shaka.findAvailableInventory()
- inv = peripheral.wrap(storage)
- depotInv = peripheral.wrap(machine)
- wormInv = peripheral.wrap(wormhole)
- startTimer = false
- function checkSlot(itemName)
- for _, item in pairs(items) do
- if shaka.stringFind(itemName, item) then
- return true
- end
- end
- return false
- end
- function findFilteredItems()
- for k, v in pairs(inv.list()) do
- if checkSlot(v.name) == false then
- inv.pushItems(machine, k)
- startTimer = true
- end
- end
- end
- function moveFinishedItems()
- for k, v in pairs(depotInv.list()) do
- if checkSlot(v.name) then
- depotInv.pushItems(wormhole, k)
- end
- end
- end
- function checkTimer()
- if startTimer == true then
- processingItems = {}
- startTimer = false
- for k, v in pairs(depotInv.list()) do
- processingItems[v.name] = v.count
- end
- sleep(1)
- for k, v in pairs(depotInv.list()) do
- for a, b in pairs(processingItems) do
- if a == v.name and b == v.count then
- print(v.name.. " has been here too long. Begone.")
- depotInv.pushItems(wormhole, k)
- return true
- end
- end
- end
- else
- sleep(0.1)
- end
- end
- while true do
- moveFinishedItems()
- findFilteredItems()
- checkTimer()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement