Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- perilist=peripheral.getNames()
- ap="south"
- t="north"
- jars={}
- aspects={}
- slots={}
- interfaces={}
- analyzers={}
- a=nil
- local function perisort()
- for i = 1, #perilist do
- if string.find(peripheral.getType(perilist[i]),"tt_aspectContainer") and #peripheral.call(perilist[i], "getAspects")~=0 then
- jars[#jars+1]=perilist[i]
- elseif string.find(peripheral.getType(perilist[i]),"tileinterface") then
- interfaces[#interfaces+1]=perilist[i]
- elseif string.find(peripheral.getType(perilist[i]),"tt_aspectanalyzer") then
- analyzers[#analyzers+1]=perilist[i]
- print(analyzers[#analyzers]," connected")
- end
- end
- end
- local function scan()
- for i = 1, #jars do
- aspects[peripheral.call(jars[i], "getAspects")[1]]=peripheral.call(jars[i], "getAspectCount",peripheral.call(jars[i], "getAspects")[1])
- end
- end
- local function sort()
- for i=1,#interfaces do
- peripheral.call(interfaces[i],"pushItem",ap,1,1)
- for k=1,#analyzers do
- if peripheral.call(analyzers[k], "hasItem") then
- a=peripheral.wrap(analyzers[k])
- end
- end
- peripheral.call(interfaces[i],"pullItem",ap,1,64,1)
- for j=1,8 do
- if peripheral.call(interfaces[i],"getStackInSlot",j)~=nil then
- s=1
- peripheral.call(interfaces[i],"pushItem",ap,j,1)
- if a.getAspects()[1]=="auram" then
- s=2
- end
- slots[a.getAspects()[s]]={i,j}
- print(a.getAspects()[s])
- peripheral.call(interfaces[i],"pullItem",ap,1,64,j)
- end
- end
- end
- end
- local function push(place,slot,amount)
- amount=amount-(amount%2)
- give=amount/2
- print(interfaces[place])
- peripheral.call(interfaces[place],"pushItem",t,slot,give)
- end
- perisort()
- sort()
- scan()
- for aspect, amount in pairs(aspects) do
- print(slots[aspect][1]," ",amount)
- if amount<63 then
- push(slots[aspect][1],slots[aspect][2], 64-amount)
- sleep(1)--((64-amount)*3)+2)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement