Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- reactor1 = peripheral.wrap("BigReactors-Reactor_0")
- mon = peripheral.wrap("monitor_2")
- x, y = 1, 1
- maxX, maxY = mon.getSize()
- lastRFStored = reactor1.getEnergyStored()
- function showHeading(title)
- mon.setTextColor(colors.lightBlue)
- mon.setCursorPos((maxX - #title) / 2, y)
- mon.write(title)
- y = y + 1
- end
- function showInfo(desc, val, coloring, maxVal)
- mon.setCursorPos((maxX / 2) - #desc, y)
- mon.setTextColor(colors.black)
- mon.write(desc)
- mon.setTextColor(colors.lime)
- if(type(val) == "number") then
- val = math.floor(val)
- end
- if(coloring == 1) then
- setTextColorLowBad(val, maxVal)
- elseif(coloring == 2) then
- setTextColorHighBad(val, maxVal)
- end
- mon.write(val)
- y = y + 1
- end
- function setTextColorLowBad(val, maxVal)
- if(type(val) == "boolean") then
- if(val == true) then
- mon.setTextColor(colors.lime)
- else
- mon.setTextColor(colors.red)
- end
- elseif(type(val) == "number") then
- local pct = val / maxVal
- if(pct <= 0.33) then
- mon.setTextColor(colors.red)
- elseif(pct <= 0.66) then
- mon.setTextColor(colors.orange)
- else
- mon.setTextColor(colors.lime)
- end
- end
- end
- function setTextColorHighBad(val, maxVal)
- if(type(val) == "boolean") then
- if(val == true) then
- mon.setTextColor(colors.red)
- else
- mon.setTextColor(colors.lime)
- end
- elseif(type(val) == "number") then
- local pct = val / maxVal
- if(pct <= 0.33) then
- mon.setTextColor(colors.lime)
- elseif(pct <= 0.66) then
- mon.setTextColor(colors.orange)
- else
- mon.setTextColor(colors.red)
- end
- end
- end
- while true do
- x, y = 1, 1
- mon.clear()
- mon.setBackgroundColor(colors.white)
- showHeading("GENERAL INFO")
- showInfo("Active", reactor1.getActive(), 1, 0)
- local energyInc = false
- if(reactor1.getEnergyStored() > lastRFStored) then
- energyInc = true
- end
- showInfo("Sustainable", energyInc, 1, 0)
- showHeading("ENERGY INFO")
- showInfo("RF/T", reactor1.getEnergyProducedLastTick(),1, 260)
- showInfo("RF Stored", reactor1.getEnergyStored(), 1, 1000000)
- showHeading("TEMPERATURE INFO")
- showInfo("Casing Heat", reactor1.getCasingTemperature(), 2, 1000)
- showInfo("Fuel Heat", reactor1.getFuelTemperature(), 2, 1000)
- lastRFStored = reactor1.getEnergyStored()
- sleep(2.5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement