Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------------------//Initilisation
- local monitor = peripheral.wrap("right")
- monitor.setTextScale(1)
- term.redirect(monitor)
- local ptc = "reactorNetwork"
- local hostname = "tbScreen"
- rednet.open("top")
- rednet.host(ptc, hostname)
- local info = {}
- local color = {}
- local res
- print("Connection ...")
- -------------------------------------------------//getInfo()
- function getInfo()
- res, info = rednet.receive(ptc, 10)
- end
- -------------------------------------------------//serialize()
- function serialize()
- tb1EnergyPerc = ((info.tb1rotorSpeed/1000000)*47)
- tb1RpmPerc = ((info.tb1rotorSpeed/2000)*47)
- tb2EnergyPerc = ((info.tb2rotorSpeed/1000000)*47)
- tb2RpmPerc = ((info.tb2rotorSpeed/2000)*47)
- tb3EnergyPerc = ((info.tb3rotorSpeed/1000000)*47)
- tb3RpmPerc = ((info.tb3rotorSpeed/2000)*47)
- end
- -------------------------------------------------//affichage()
- function affichage()
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(21, 2)
- term.write("TURBINES")
- --titre ecran
- color[1] = (info.tb1Active and colors.green or colors.red)
- color[2] = (info.tb2Active and colors.green or colors.red)
- color[3] = (info.tb3Active and colors.green or colors.red)
- paintutils.drawFilledBox(1, 6, 50, 13, color[1])
- paintutils.drawFilledBox(1, 16, 50, 23, color[2])
- paintutils.drawFilledBox(1, 26, 50, 33, color[3])
- term.setBackgroundColor(colors.black)
- term.setCursorPos(2, 5)
- term.write("Turbine 1 "..(info.tb1Active and "[ON]" or "[OFF]"))
- term.setCursorPos(30, 5)
- term.write("RF/t : "..math.floor(info.tb1energyLastTick))
- term.setBackgroundColor(color[1])
- term.setCursorPos(2, 7)
- term.write("RPM "..math.floor(info.tb1rotorSpeed))
- term.setCursorPos(2, 10)
- term.write("Energy Stored "..math.floor(info.tb1energyStored))
- paintutils.drawFilledBox(2, 8, 2 + tb1RpmPerc, 9, colors.yellow)
- paintutils.drawFilledBox(2, 11, 2 + tb1EnergyPerc, 12, colors.yellow)
- term.setBackgroundColor(colors.black)
- term.setCursorPos(2, 15)
- term.write("Turbine 2 "..(info.tb2Active and "[ON]" or "[OFF]"))
- term.setCursorPos(30, 15)
- term.write("RF/t : "..math.floor(info.tb2energyLastTick))
- term.setBackgroundColor(color[2])
- term.setCursorPos(2, 17)
- term.write("RPM "..math.floor(info.tb2rotorSpeed))
- term.setCursorPos(2, 20)
- term.write("Energy Stored "..math.floor(info.tb2energyStored))
- paintutils.drawFilledBox(2, 18, 2 + tb2RpmPerc, 19, colors.yellow)
- paintutils.drawFilledBox(2, 21, 2 + tb2EnergyPerc, 22, colors.yellow)
- term.setBackgroundColor(colors.black)
- term.setCursorPos(2, 25)
- term.write("Turbine 3 "..(info.tb3Active and "[ON]" or "[OFF]"))
- term.setCursorPos(30, 25)
- term.write("RF/t : "..math.floor(info.tb3energyLastTick))
- term.setBackgroundColor(color[3])
- term.setCursorPos(2, 27)
- term.write("RPM "..math.floor(info.tb3rotorSpeed))
- term.setCursorPos(2, 30)
- term.write("Energy Stored "..math.floor(info.tb3energyStored))
- paintutils.drawFilledBox(2, 28, 2 + tb3RpmPerc, 29, colors.yellow)
- paintutils.drawFilledBox(2, 31, 2 + tb3EnergyPerc, 32, colors.yellow)
- end
- -------------------------------------------------//Main Script
- while(true)do
- getInfo()
- serialize()
- affichage()
- end
Advertisement
Add Comment
Please, Sign In to add comment