Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Data = {}
- local bridge = peripheral.wrap("top")
- local Width = 50
- function FillData()
- for i =1,#peripheral.getNames() do
- if peripheral.getNames()[i] ~= "left" and peripheral.getNames()[i] ~= "top" then
- Data[i] = {}
- Data[i]["Side"] = peripheral.getNames()[i]
- Data[i]["Name"] = peripheral.getType(Data[i]["Side"])
- Data[i]["Capacity"] = peripheral.call(Data[i]["Side"],"getEUCapacity")
- Data[i]["Stored"] = peripheral.call(Data[i]["Side"],"getEUStored")
- end
- end
- end
- function Middle(txt)
- local f = (15+Width)/2
- return f
- end
- function MaJ()
- for i =1,#peripheral.getNames() do
- if peripheral.getNames()[i] ~= "left" and peripheral.getNames()[i] ~= "top" then
- Barre[i].setWidth(Data[i]["Stored"]/Data[i]["Capacity"]*Width)
- Name[i].setText(Data[i]["Name"])
- Name[i].setX(Middle(Data[i]["Name"]))
- Pourcent[i].setText(math.floor(Data[i]["Stored"]/Data[i]["Capacity"]*100))
- Pourcent[i].setX(Middle(Pourcent[i].getText()))
- end
- end
- end
- --**********************
- --*****MainProgramm*****
- --**********************
- local y = 15
- Barre = {}
- Name = {}
- Pourcent = {}
- for i =1,#peripheral.getNames() do
- if peripheral.getNames()[i] ~= "left" and peripheral.getNames()[i] ~= "top" then
- bridge.addGradientBox(15,y,Width+2,18,0x000000,1,0x101010,0.75,2)
- Barre[i] = bridge.addGradientBox(16,y+1,0,16,0xCC1818,0.5,0xCC1010,0.75,2)
- Name[i] = bridge.addText(0,y+10," ",0xFFFFFF)
- Name[i].setScale(0.8)
- Pourcent[i] = bridge.addText(0,y+7," ",0xFFFFFF)
- Pourcent[i].setScale(0.5)
- y = y+24
- end
- end
- while true do
- FillData()
- MaJ()
- os.sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment