Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PeripheralTypes={
- insolator="thermal:machine_insolator",
- drawer="standardDrawer"
- }
- ItemNames={
- tallBush="endergetic:tall_poise_bush",
- bush="endergetic:poise_bush",
- slime="tconstruct:ender_slime_ball",
- poiseBlock="endergetic:poise_cluster"
- }
- Peripherals={
- tallBushInsolators={},
- clusterInsolators={},
- bushInsolators={},
- tallBushDrawer=nil,
- bushDrawer=nil,
- slimeDrawer=nil,
- poiseBlockDrawer=nil,
- wrap=function(name)
- local perip = peripheral.wrap(name)
- perip.name = name
- return perip
- end,
- wrapAll=function(self)
- local insolatorCount = 0
- for _,name in ipairs(peripheral.getNames()) do
- local t = peripheral.getType(name)
- if t == PeripheralTypes.insolator then
- if insolatorCount % 5 == 0 then
- table.insert(self.tallBushInsolators,self.wrap(name))
- elseif insolatorCount % 5 == 1 then
- table.insert(self.clusterInsolators,self.wrap(name))
- else
- table.insert(self.bushInsolators,self.wrap(name))
- end
- insolatorCount = insolatorCount + 1
- elseif t == PeripheralTypes.drawer then
- local drawer = self.wrap(name)
- local itemName = drawer.getItemDetail(1).name
- if itemName == ItemNames.poiseBlock then
- self.poiseBlockDrawer = drawer
- elseif itemName == ItemNames.bush then
- self.bushDrawer = drawer
- elseif itemName == ItemNames.tallBush then
- self.tallBushDrawer = drawer
- elseif itemName == ItemNames.slime then
- self.slimeDrawer = drawer
- end
- end
- end
- end
- }
- Peripherals:wrapAll()
- for _,insolatorList in ipairs({"tallBushInsolators","clusterInsolators","bushInsolators"}) do
- for _,insolator in ipairs(Peripherals[insolatorList]) do
- local items = insolator.list()
- for slot,item in pairs(items) do
- if item.name == ItemNames.bush then
- insolator.pushItems(Peripherals.bushDrawer.name,slot)
- elseif item.name == ItemNames.tallBush then
- insolator.pushItems(Peripherals.tallBushDrawer.name,slot)
- elseif item.name == ItemNames.poiseBlock then
- insolator.pushItems(Peripherals.poiseBlockDrawer.name,slot)
- elseif item.name == ItemNames.slime then
- insolator.pushItems(Peripherals.slimeDrawer.name,slot)
- end
- end
- end
- end
- while true do
- local tallBushCount = Peripherals.tallBushDrawer.getItemDetail(1).count
- if tallBushCount > 1000 then
- while Peripherals.tallBushDrawer.getItemDetail(1).count > 800 do
- sleep(60)
- end
- end
- term.clear()
- term.setCursorPos(1,1)
- print("handling tall bush insolators")
- for _,insolator in ipairs(Peripherals.tallBushInsolators) do
- Peripherals.tallBushDrawer.pushItems(insolator.name,1,math.ceil(tallBushCount / #Peripherals.tallBushInsolators),1)
- local items = insolator.list()
- for slot,item in pairs(items) do
- if item.name == ItemNames.poiseBlock then
- insolator.pushItems(Peripherals.poiseBlockDrawer.name,slot,64)
- end
- end
- end
- local poiseBlockCount = Peripherals.poiseBlockDrawer.getItemDetail(1).count
- term.clear()
- term.setCursorPos(1,1)
- print("handling poise cluster insolators")
- for _,insolator in ipairs(Peripherals.clusterInsolators) do
- Peripherals.poiseBlockDrawer.pushItems(insolator.name,1,math.ceil(poiseBlockCount / #Peripherals.clusterInsolators),1)
- local items = insolator.list()
- for slot,item in pairs(items) do
- if item.name == ItemNames.bush then
- insolator.pushItems(Peripherals.bushDrawer.name,slot,64)
- elseif item.name == ItemNames.slime then
- insolator.pushItems(Peripherals.slimeDrawer.name,slot,64)
- end
- end
- end
- local bushCount = Peripherals.bushDrawer.getItemDetail(1).count
- term.clear()
- term.setCursorPos(1,1)
- print("handling bush insolators")
- for _,insolator in ipairs(Peripherals.bushInsolators) do
- Peripherals.bushDrawer.pushItems(insolator.name,1,math.ceil(bushCount / #Peripherals.bushInsolators),1)
- local items = insolator.list()
- for slot,item in pairs(items) do
- if item.name == ItemNames.tallBush then
- insolator.pushItems(Peripherals.tallBushDrawer.name,slot,64)
- elseif item.name == ItemNames.poiseBlock then
- insolator.pushItems(Peripherals.poiseBlockDrawer.name,slot,64)
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment