Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bridge = peripheral.wrap("right")
- local net = peripheral.wrap("bottom")
- local restart = 0
- bridge.clear()
- local width = 200
- local storageUnits = {
- {
- ["id"] = "cofh_thermalexpansion_energycell_1",
- ["name"] = "Main Energycell",
- ["type"] = "te"
- },
- {
- ["id"] = "cofh_thermalexpansion_energycell_2",
- ["name"] = "LogisticPipes Extra Power",
- ["type"] = "te"
- },
- {
- ["id"] = "cofh_thermalexpansion_energycell_4",
- ["name"] = "Laser Power",
- ["type"] = "te"
- },
- {
- ["id"] = "cofh_thermalexpansion_energycell_3",
- ["name"] = "Swap Cell",
- ["type"] = "te"
- },
- {
- ["id"] = "ender_tank_0",
- ["name"] = "Lava",
- ["nameC"] = "Lava",
- ["type"] = "Liquid"
- }
- }
- local offset = 1
- for key, storageUnit in pairs(storageUnits) do
- pxOffset = offset * 20
- storageUnit["label"] = bridge.addText(4, 4 + pxOffset, storageUnit["name"], 0x6b6b6b)
- storageUnit["bar"] = bridge.addBox(4, 14 + pxOffset, 0, 5, 0xCC0000, 0.9)
- -- storageUnit["bar"].setZIndex(2)
- storageUnit["bg"] = bridge.addBox(4, 14 + pxOffset, width, 5, 0x000000, 0.5)
- offset = offset + 1
- print(offset)
- end
- storageUnit = storageUnits[4]
- print(storageUnit["type"])
- while true do
- for i=#storageUnits,1,-1 do
- storageUnit = storageUnits[i]
- if net.isPresentRemote(storageUnit["id"]) then
- if storageUnit["type"] == "ic" then
- capacity = net.callRemote(storageUnit["id"], "getEUCapacity")
- amount = net.callRemote(storageUnit["id"], "getEUStored")
- storageUnit["bar"].setWidth(width / capacity * amount)
- elseif storageUnit["type"] == "te" then
- capacity = net.callRemote(storageUnit["id"], "getMaxEnergyStored", "unknown")
- amount = net.callRemote(storageUnit["id"], "getEnergyStored", "unknown")
- storageUnit["bar"].setWidth(width / capacity * amount)
- storageUnit["bar"].setColor(0x009c00)
- elseif storageUnit["type"] == "Liquid" then
- m = peripheral.wrap(storageUnit["id"])
- tanksTable = m.getTankInfo("unknown")
- maintank = tanksTable[1]
- if maintank.amount == nil then maintank.amount = 0 end
- capacity = maintank.capacity
- amount = maintank.amount
- storageUnit["bar"].setWidth(width / capacity * amount)
- storageUnit["bar"].setColor(0xdc0000)
- storageUnit["name"] = storageUnits[i]["nameC"].." ("..maintank.amount.."/"..maintank.capacity..")"
- --print(storageUnit["name"])
- storageUnit["label"].setText(storageUnit["name"])
- end
- else
- storageUnit["bar"].setWidth(0)
- end
- end
- if restart > 500 then
- --shell.run("reboot")
- end
- restart = restart+1
- print(restart)
- sleep(0.01)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement