Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local peripheral_util = require("./lib/peripheral_util")
- local logId = "minecraft:acacia_log"
- local strippedLogId = "minecraft:stripped_acacia_log"
- local fluidExtractors = peripheral_util.find("industrialforegoing:fluid_extractor")
- print(string.format("Found %d fluid extractors", #fluidExtractors))
- local routers = peripheral_util.find("modularrouters:modular_router")
- print(string.format("Found %d routers", #routers))
- local storage = peripheral.find("rsBridge")
- local trash = peripheral.find("trashcans:item_trash_can_tile")
- local trashName = peripheral.getName(trash)
- os.sleep(0.1)
- while true do
- local importedLatexAmountTotal = 0
- for _, fluidExtractor in pairs(fluidExtractors) do
- local importedLatexAmount = storage.importFluidFromPeripheral({name="industrialforegoing:latex"}, peripheral.getName(fluidExtractor))
- importedLatexAmountTotal = importedLatexAmountTotal + importedLatexAmount
- end
- if importedLatexAmountTotal > 0 then
- print(string.format("Stored %dmB of latex", importedLatexAmountTotal))
- end
- os.sleep(1)
- for _, router in pairs(routers) do
- local routerItem = router.getItemDetail(1)
- if routerItem ~= nil then
- if routerItem["name"] == strippedLogId then
- print("Acacia log stripped, replacing it")
- router.pushItems(trashName, 1)
- os.sleep(0.05)
- storage.exportItemToPeripheral({name=logId, count=1}, peripheral.getName(router))
- print("Acacia log replaced")
- end
- end
- end
- os.sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment