Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mon = peripheral.wrap("back")
- mon.setTextScale(.5)
- Draw={}
- Draw["x"] = {
- 2,
- 2,
- 2,
- 2,
- 2,
- 2,
- 2,
- 2,
- 2,
- 2
- }
- Draw["y"] = {
- 2,
- 4,
- 6,
- 8,
- 10,
- 12,
- 14,
- 16,
- 18,
- 20
- }
- Draw["bgc"] = {
- colors.black, --1
- colors.black, --2
- colors.black, --3
- colors.black, --4
- colors.black, --5
- colors.black, --6
- colors.black, --7
- colors.black, --8
- colors.black, --9
- colors.black
- }
- Draw["energyColor"] = {
- colors.red,
- colors.red,
- colors.red,
- colors.red,
- colors.red,
- colors.red,
- colors.red,
- colors.red,
- colors.red,
- colors.red
- }
- Draw["txt"] = {
- "EnergyCell: 1",
- "EnergyCell: 2",
- "EnergyCell: 3",
- "EnergyCell: 4",
- "EnergyCell: 5",
- "EnergyCell: 6",
- "EnergyCell: 7",
- "EnergyCell: 8",
- "EnergyCell: 9",
- "EnergyCell: 10"
- }
- Draw["txtColor"] = {
- colors.lime,
- colors.lime,
- colors.lime,
- colors.lime,
- colors.lime,
- colors.lime,
- colors.lime,
- colors.lime,
- colors.lime,
- colors.lime
- }
- Draw["state"] = {
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true,
- true
- }
- Draw["OC"] = {
- colors.white,
- colors.orange,
- colors.magenta,
- colors.lightBlue,
- colors.yellow,
- colors.lime,
- colors.pink,
- colors.gray,
- colors.lightGray,
- colors.cyan
- }
- Draw["side"] = {
- "right",
- "right",
- "right",
- "right",
- "right",
- "right",
- "right",
- "right",
- "right",
- "right"
- }
- --percentages
- Draw["max"] = {99,99,99,99,99,99,99,99,99,99}
- Draw["min"] = {10,10,10,10,10,10,10,10,10,10}
- --Totals
- Draw["maxX"] = {2}
- Draw["maxY"] = {24}
- Draw["maxMax"] = {95}
- Draw["maxMin"] = {30}
- Draw["maxTxtColor"] = {colors.lime}
- Draw["maxEnergyColor"] = {colors.red}
- Draw["maxTxt"] = {"Total Power"}
- Draw["maxSide"] = {"right"}
- Draw["MOC"] = {colors.white}
- Draw["MaxState"] = {false}
- --Peripherals
- Cell = {
- peripheral.wrap("cofh_thermalexpansion_energycell_26"),
- peripheral.wrap("cofh_thermalexpansion_energycell_22"),
- peripheral.wrap("cofh_thermalexpansion_energycell_25"),
- peripheral.wrap("cofh_thermalexpansion_energycell_23"),
- peripheral.wrap("cofh_thermalexpansion_energycell_29"),
- peripheral.wrap("cofh_thermalexpansion_energycell_24"),
- peripheral.wrap("cofh_thermalexpansion_energycell_30"),
- peripheral.wrap("cofh_thermalexpansion_energycell_27"),
- peripheral.wrap("cofh_thermalexpansion_energycell_31"),
- peripheral.wrap("cofh_thermalexpansion_energycell_28")
- }
- function EnergyStored(number)
- Energy = Cell[number].getEnergyStored("unknown")
- return Energy
- end
- function MaxEnergyStored(number)
- Energy = Cell[number].getMaxEnergyStored("unknown")
- return Energy
- end
- function clear()
- mon.setBackgroundColor(colors.black)
- mon.clear()
- end
- clear()
- function Set()
- local x = 1
- for i = x, #Draw["x"] do
- mon.setCursorPos(Draw["x"][i],Draw["y"][i])
- mon.setTextColor(Draw["energyColor"][i])
- mon.setBackgroundColor(Draw["bgc"][i])
- MaxEnergy = MaxEnergyStored(i)
- StoredEnergy = EnergyStored(i)
- --MaxEnergy = 0
- --StoredEnergy = 0
- Percent = math.floor((StoredEnergy / MaxEnergy) * 100)
- mon.setTextColor(Draw["txtColor"][i])
- mon.write(Draw["txt"][i].." ")
- mon.setCursorPos(Draw["x"][i], Draw["y"][i] + 1)
- mon.setTextColor(Draw["energyColor"][i])
- mon.write(StoredEnergy.." / "..MaxEnergy.." ")
- if Percent >= Draw["max"][i] then
- mon.setTextColor(colors.green)
- Draw["state"][i] = false
- elseif Percent <= Draw["min"][i] then
- mon.setTextColor(colors.red)
- Draw["state"][i] = true
- else
- mon.setTextColor(colors.orange)
- end
- --mon.setCursorPos(Draw[1][i],Draw[2][i] + 1)
- mon.write(Percent.."% ")
- end
- end
- -----------------------Totals-----------------------
- function TotalEnergyStored()
- local x = 1
- local Total = 0
- for i = x,#Cell do
- Total = Total + Cell[i].getEnergyStored("unknown")
- end
- return Total
- end
- function TotalStorage()
- local x = 1
- local Total = 0
- for i = x,#Cell do
- Total = Total + Cell[i].getMaxEnergyStored("unknown")
- end
- return Total
- end
- function Max()
- local x = 0
- mon.setCursorPos(Draw["maxX"][1], Draw["maxY"][1])
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(Draw["maxTxtColor"][1])
- mon.write(Draw["maxTxt"][1])
- mon.setCursorPos(Draw["maxX"][1], Draw["maxY"][1] + 1)
- mon.setTextColor(Draw["maxEnergyColor"][1])
- Energy = TotalEnergyStored()
- Storage = TotalStorage()
- Percentage = math.floor((Energy / Storage) * 100)
- mon.write(Energy.." / "..Storage.." ")
- if Percentage >= Draw["maxMax"][1] then
- mon.setTextColor(colors.green)
- Draw["MaxState"][1] = false
- elseif Percentage <= Draw["maxMin"][1] then
- mon.setTextColor(colors.red)
- Draw["MaxState"][1] = true
- else
- mon.setTextColor(colors.orange)
- end
- mon.write(Percentage.."% ")
- if Draw["MaxState"][1] == true then
- mon.setCursorPos(Draw["maxX"][1],Draw["maxY"][1] + 2)
- mon.setTextColor(colors.gray)
- mon.write("Reactor: ")
- mon.setTextColor(colors.lime)
- mon.write("Active ")
- elseif Draw["MaxState"][1] == false then
- mon.setCursorPos(Draw["maxX"][1],Draw["maxY"][1] + 2)
- mon.setTextColor(colors.gray)
- mon.write("Reactor: ")
- mon.setTextColor(colors.red)
- mon.write("InActive")
- end
- end
- function MaxRedstone()
- if Draw["MaxState"][1] == true then
- rs.setBundledOutput(Draw["maxSide"][1],colors.combine(rs.getBundledOutput(Draw["maxSide"][1]),Draw["MOC"][1]))
- elseif Draw["MaxState"][1] == false then
- rs.setBundledOutput(Draw["maxSide"][1],colors.subtract(rs.getBundledOutput(Draw["maxSide"][1]),Draw["MOC"][1]))
- end
- end
- function Redstone()
- local x = 1
- for i = x, #Draw["state"] do
- if Draw["state"][i] == true then
- rs.setBundledOutput(Draw["side"][i],colors.combine(rs.getBundledOutput(Draw["side"][i]),Draw["OC"][i]))
- elseif Draw["state"][i] == false then
- rs.setBundledOutput(Draw["side"][i],colors.subtract(rs.getBundledOutput(Draw["side"][i]),Draw["OC"][i]))
- end
- end
- end
- while true do
- Set()
- Max()
- MaxRedstone()
- sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement