Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Energy Monitor
- --Energy Cells
- cells = {
- peripheral.wrap("cofh_thermalexpansion_energycell_19"),
- peripheral.wrap("cofh_thermalexpansion_energycell_20")
- }
- --Max Energy
- function getMaxEnergy(Str)
- return cells[Str].getMaxEnergyStored("unknown")
- end
- --Stored Energy
- function getStoredEnergy(Str)
- return cells[Str].getEnergyStored("unknown")
- end
- --Percentage
- function percent(minVal,maxVal)
- return math.floor((minVal/maxVal)*100)
- end
- --Monitor
- monitor= peripheral.wrap("top")
- monitor.setTextScale(0.5)
- monitor.setBackgroundColor(colors.white)
- monitor.clear()
- monitor.setBackgroundColor(colors.white)
- monitor.setTextColor(colors.black)
- --Cursor
- function Cursor()
- local oldX, oldY = monitor.getCursorPos()
- return oldY
- monitor.setCursorPos(1, oldY+1)
- end
- --Redstone Operator
- full1 = false
- full2 = false
- --Loop Body
- while true do
- for i=1, 2 do
- monitor.write("Cell# "..i)
- Cursor()
- monitor.write(" > Capacity:"..getMaxEnergy(i))
- Cursor()
- monitor.write(" > Stored: "..getStoredEnergy(i))
- Cursor()
- monitor.write(" > Percent: "..percent(getStoredEnergy(i),getMaxEnergy(i)).."%")
- Cursor()
- monitor.write("------")
- Cursor()
- sleep(1)
- if getStoredEnergy(i) == getMaxEnergy(i) and i==1 then
- full1=true
- elseif getStoredEnergy(i) == getMaxEnergy(i) and i==2 then
- full2=true
- end
- if full1==true and full2==true then
- peripheral.wrap("right")
- rs.setBundledOutput("right", 1)
- else
- rs.setBundledOutput("right", 4)
- end
- end
- sleep(10)
- term.clear()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement