Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local capacitor_1 = peripheral.wrap("left")
- local monitor = peripheral.wrap("monitor_9")
- color = 128 --Default grey
- monitor.setTextColor(1) --text will be white
- monitor.setBackgroundColor(color) --background will be gray
- monitor.clear() --paint the background
- i = 1
- --percentage math constants
- makePercent = 100
- capacitorCount = 4
- alertThreshold = 75
- capacitorBasic = 1000000
- capacitorStandard = 5000000
- capacitorVibrant = 25000000
- totalCapacity = (capacitorCount) * (capacitorBasic)
- fillPercentage = 0
- difference = 0
- while true do
- energyLevel1 = capacitor_1.getEnergyStored()
- energyAdjusted = (energyLevel1) * (capacitorCount)
- --print(energyAdjusted)
- fillLevel = (4500000) * (capacitorCount)
- lowFillLevel = (3000000) * (capacitorCount)
- monitor.setCursorPos(1,1)
- print("Generators with start at "..lowFillLevel.." RF")
- print("Current energy storage is "..energyAdjusted.." RF")
- difference = (totalCapacity) - (energyAdjusted)
- fillAmount = (energyAdjusted) / (totalCapacity)
- fillPercentage = (fillAmount) * (100)
- fillInt = math.floor(fillPercentage)
- monitor.setTextColor(1)
- if fillInt <= alertThreshold then
- color = colors.orange
- monitor.setBackgroundColor(color)
- monitor.setCursorPos(1, 1)
- monitor.write("ALERT: LOW PWR!")
- end
- if fillInt == 0 then
- color = colors.red
- monitor.setCursorPos(1, 1)
- monitor.write("POWER OUTAGE!")
- end
- if fillInt == 100 then
- color = colors.green
- monitor.setBackgroundColor(color)
- monitor.setCursorPos(1, 1)
- monitor.write("Fully Charged.")
- end
- monitor.setCursorPos(1,2)
- monitor.setTextColor(1)
- monitor.write("Power Status:")
- monitor.setCursorPos(1,4)
- monitor.write(fillInt.."% capacity")
- monitor.setCursorPos(1,6)
- monitor.write(energyAdjusted.."/"..totalCapacity.."RF")
- monitor.setCursorPos(1,11)
- monitor.write("Banks: "..capacitorCount)
- monitor.setCursorPos(1,12)
- monitor.write("RedNet State: ")
- monitor.setTextColor(colors.red) -- Add REDNET intergration later.
- monitor.write("DOWN")
- --monitor.write(string.format("%.2fillPercentage", fillPercentage))
- sleep(2.5)
- monitor.clear()
- end
Advertisement
Add Comment
Please, Sign In to add comment