Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- EnergyCell = {}
- hMon = {}
- vMon = {}
- pPower = 0
- Power = 0
- Capacity = 0
- dPower = 0
- dCapacity = 0
- dif = 0
- pList = peripheral.getNames()
- for i=1,#pList do
- if peripheral.getType(pList[i]) == "thermalexpansion:storage_cell" then
- EnergyCell[#EnergyCell+1] = peripheral.wrap(pList[i])
- end
- if peripheral.getType(pList[i]) == "monitor" then
- v,h = peripheral.wrap(pList[i]).getSize()
- if v == 18 then
- hMon[#hMon+1] = peripheral.wrap(pList[i])
- end
- if v == 7 then
- vMon[#vMon+1] = peripheral.wrap(pList[i])
- end
- end
- end
- for i = 1,#EnergyCell do
- Power = Power + EnergyCell[i].getRFStored()
- Capacity = Capacity + EnergyCell[i].getRFCapacity()
- end
- while true do
- term.clear()
- term.setCursorPos(1,1)
- print("Cellule : "..#EnergyCell)
- print(Power.." RF/"..Capacity.." RF")
- print(math.floor(dif/20).." RF/t")
- Pourcent = (Capacity / Power) * 100
- pPower = Power
- Power = 0
- for i = 1,#EnergyCell do
- Power = Power + EnergyCell[i].getRFStored()
- end
- dif = Power - pPower
- if Power > 100000 then
- dPower = math.floor(Power/1000).."K"
- end
- if Power > 1000000 then
- dPower = math.floor(Power/1000000).."M"
- end
- if Capacity > 100000 then
- dCapacity = math.floor(Capacity/1000).."K"
- end
- if Capacity > 1000000 then
- dCapacity = math.floor(Capacity/1000000).."M"
- end
- for h = 1,#hMon do
- hMon[h].setTextScale(2)
- hMon[h].clear()
- hMon[h].setTextColor(colors.white)
- hMon[h].setCursorPos(1,1)
- hMon[h].write(dPower.." RF/"..dCapacity.." RF")
- hMon[h].setCursorPos(1,2)
- hMon[h].write(Pourcent.." %")
- hMon[h].setCursorPos(1,3)
- if dif > 0 then
- hMon[h].setTextColor(colors.green)
- hMon[h].write(tostring(dif).." RF/s")
- hMon[h].setCursorPos(1,4)
- hMon[h].write("Full in "..math.floor((Capacity - Power) / dif).."s")
- elseif dif < 0 then
- hMon[h].setTextColor(colors.red)
- hMon[h].write(tostring(dif).." RF/s")
- hMon[h].setCursorPos(1,4)
- hMon[h].write("Empty in "..math.floor(Power / (dif*-1)).."s")
- elseif dif == 0 then
- hMon[h].setTextColor(colors.white)
- hMon[h].write(tostring(dif).." RF/s")
- end
- end
- for v = 1,#vMon do
- vMon[v].clear()
- vMon[v].setCursorPos(1,1)
- vMon[v].write("Not in")
- vMon[v].setCursorPos(1,2)
- vMon[v].write("use!")
- vMon[v].setCursorPos(1,3)
- vMon[v].write("now...")
- end
- sleep(0.8)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement