Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.close("bottom")
- rednet.open("bottom")
- mon = peripheral.wrap("top")
- monHeader = " Turbine No. ##HEADERNUM##"
- rednetTurbine = "BigReactors-Turbine_##MACHINENUM##"
- -- Wrap turbine
- turbine = peripheral.wrap(rednetTurbine)
- -- Write monitor text colors
- function writeRed(text)
- mon.setTextColor(colors.red)
- mon.write(text)
- mon.setTextColor(colors.white)
- end
- function writeGreen(text)
- mon.setTextColor(colors.green)
- mon.write(text)
- mon.setTextColor(colors.white)
- end
- function writeOrange(text)
- mon.setTextColor(colors.orange)
- mon.write(text)
- mon.setTextColor(colors.white)
- end
- function resetScreen()
- mon.setBackgroundColor(colors.black)
- mon.setTextColor(colors.white)
- mon.clear()
- mon.setCursorPos(1,2)
- mon.write(monHeader)
- mon.setCursorPos(2,4)
- end
- function nextWriteLine()
- local cX,cY = mon.getCursorPos()
- mon.setCursorPos(2,cY+1)
- end
- function numberRound(number)
- local High = math.ceil(number) - number
- if High >= .5 then
- return math.ceil(number)
- else
- return math.floor(number)
- end
- end
- term.setCursorPos(1,1)
- term.clear()
- term.write("Running monitor")
- while true do
- resetScreen()
- -- Active
- mon.write("Active: ")
- if(turbine.getActive() == true) then
- writeGreen("true")
- else
- writeOrange("false")
- end
- nextWriteLine()
- -- Induction coils
- mon.write("Ind. coils: ")
- if(turbine.getInductorEngaged() == true) then
- writeGreen("true")
- else
- writeOrange("false")
- end
- nextWriteLine()
- -- Rotor speed
- mon.write("Rotor speed: ")
- local rotorSpeed = turbine.getRotorSpeed()
- if(rotorSpeed > 1810) then
- writeRed(numberRound(rotorSpeed))
- elseif(rotorSpeed < 1780 and rotorSpeed > 0) then
- writeOrange(numberRound(rotorSpeed))
- elseif(rotorSpeed >= 1780 and rotorSpeed <= 1810) then
- writeGreen(numberRound(rotorSpeed))
- else
- mon.write(numberRound(rotorSpeed))
- end
- mon.write(" RPM")
- nextWriteLine()
- -- Energy/tick
- mon.write("Energy/tick: ")
- mon.write(numberRound(turbine.getEnergyProducedLastTick()))
- mon.write(" RF")
- nextWriteLine()
- -- Energy stored
- mon.write("Energy stored: ")
- mon.write(numberRound(turbine.getEnergyStored()))
- mon.write(" RF")
- nextWriteLine()
- -- Fluid rate
- mon.write("Fluid flow: ")
- mon.write(numberRound(turbine.getFluidFlowRate()))
- mon.write(" mb")
- sleep(5)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement