Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --pastebin code: G47j7rDW
- local bridge = peripheral.wrap("right")
- local net = peripheral.wrap("back")
- bridge.clear()
- local width = 100
- local storageUnits = {
- {
- ["id"] = "cofh_thermalexpansion_energycell_3",
- ["name"] = "Resonant"
- },
- {
- ["id"] = "cofh_thermalexpansion_energycell_4",
- ["name"] = "Resonant"
- },
- {
- ["id"] = "cofh_thermalexpansion_energycell_5",
- ["name"] = "Resonant"
- },
- {
- ["id"] = "cofh_thermalexpansion_energycell_6",
- ["name"] = "Resonant"
- },
- {
- ["id"] = "cofh_thermalexpansion_energycell_7",
- ["name"] = "Resonant"
- },
- {
- ["id"] = "cofh_thermalexpansion_energycell_8",
- ["name"] = "Resonant"
- },
- {
- ["id"] = "cofh_thermalexpansion_energycell_9",
- ["name"] = "Resonant"
- },
- {
- ["id"] = "cofh_thermalexpansion_energycell_10",
- ["name"] = "Resonant"
- },
- {
- ["id"] = "cofh_thermalexpansion_energycell_11",
- ["name"] = "Resonant"
- },
- {
- ["id"] = "harvester_0",
- ["name"] = "Tree Farm"
- },
- {
- ["id"] = "planter_0",
- ["name"] = "Planter"
- }
- }
- local offset = 0
- for key, storageUnit in pairs(storageUnits) do
- if net.getTypeRemote(storageUnit["id"]) == "cofh_thermalexpansion_energycell" then
- pxOffset = offset * 10
- --storageUnit["label"] = bridge.addText(4, 4 + pxOffset, storageUnit["name"], 0xffffff)
- storageUnit["bar"] = bridge.addBox(4, 14 + pxOffset, 0, 5, 0xCC0000, 0.9)
- storageUnit["bar"].setZ(2)
- storageUnit["bg"] = bridge.addBox(4, 14 + pxOffset, width, 5, 0x000000, 0.5)
- storageUnit["num"] = bridge.addText(4, 24 + pxOffset, "0/0", 0xffffff)
- --storageUnit["percent"] = bridge.addText(0 + bridge.getStringWidth(storageUnit["name"]), 4 + pxOffset, "##%", 0xffffff)
- offset = offset + 2
- elseif net.getTypeRemote(storageUnit["id"]) == "harvester" then
- pxOffset = offset * 10
- storageUnit["label"] = bridge.addText(4, 34 + pxOffset, storageUnit["name"].." :", 0xffffff)
- storageUnit["run"] = bridge.addText(0 + bridge.getStringWidth(storageUnit["name"]), 34 + pxOffset, "", 0xffffff)
- offset = offset + 1
- elseif net.getTypeRemote(storageUnit["id"]) == "planter" then
- pxOffset = offset * 10
- storageUnit["label"] = bridge.addText(4, 44 + pxOffset, storageUnit["name"].." :", 0xffffff)
- storageUnit["run"] = bridge.addText(0 + bridge.getStringWidth(storageUnit["name"]), 44 + pxOffset, "", 0xffffff)
- offset = offset + 1
- end
- end
- while true do
- for i=#storageUnits,1,-1 do
- storageUnit = storageUnits[i]
- if net.isPresentRemote(storageUnit["id"]) then
- if net.getTypeRemote(storageUnit["id"]) == "cofh_thermalexpansion_energycell" then
- t = peripheral.wrap(storageUnit["id"])
- capacity = capacity + t.getMaxEnergyStored("")
- amount = amount + t.getEnergyStored("")
- storageUnit["bar"].setWidth(width / capacity * amount)
- perc = math.floor(amount/capacity * 100)
- tCap = tostring(capacity)
- tAmt = tostring(amount)
- tPerc = tostring(perc)
- storageUnit["num"].setText(tAmt.."/"..tCap)
- --storageUnit["percent"].setText(tPerc.."%")
- end
- end
- end
- sleep(0.5
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement