Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- m = peripheral.find("monitor")
- modem = peripheral.wrap("right")
- local counter = 0
- function call()
- m.setTextColor(colors.white)
- modem.open(1)
- event,sender,reply,rf,RTurb1,distance=os.pullEvent("modem_message")
- modem.close(1)
- m.setCursorPos(20,5)
- m.write(comma_value(math.floor(RTurb1)).."RF/T")
- sleep(0)
- modem.open(2)
- event,sender,reply,rf,STurb1,distance=os.pullEvent("modem_message")
- modem.close(2)
- m.setCursorPos(20,7)
- m.write(comma_value(math.floor(STurb1)).."RF/T")
- sleep(0)
- modem.open(3)
- event,sender,reply,rf,STurb2,distance=os.pullEvent("modem_message")
- modem.close(3)
- m.setCursorPos(20,8)
- m.write(comma_value(math.floor(STurb2)).."RF/T")
- sleep(0)
- modem.open(4)
- event,sender,reply,rf,STurb3,distance=os.pullEvent("modem_message")
- modem.close(4)
- m.setCursorPos(20,9)
- m.write(comma_value(math.floor(STurb3)).."RF/T")
- sleep(0)
- end
- local energy=0
- m.clear()
- function powermon()
- modem.open(1)
- RFener = RTurb1+STurb1+STurb2+STurb3
- m.setCursorPos(1,3)
- m.setTextColor(colors.white)
- m.write("RF Produced: ")
- if RFener > 0 then
- m.setTextColor(colors.green)
- m.write(comma_value(math.floor(RFener)).."RF/T ")
- else
- RFener=0
- m.setTextColor(colors.red)
- m.write("0RF/T ")
- end
- sleep(0)
- modem.close(1)
- end
- function powerpercent()
- modem.open(322)
- e,s,f,rf,mess,d=os.pullEvent("modem_message")
- m.setCursorPos(1,2)
- m.setTextColor(colors.white)
- m.write("Power Stored: ")
- if mess > 50.0 then
- m.setTextColor(colors.green)
- m.write(mess.."% ")
- else
- m.setTextColor(colors.red)
- m.write(mess.."% ")
- end
- sleep(0)
- modem.close(322)
- end
- function powerusage()
- modem.open(323)
- e,s,f,rf,mess1,d=os.pullEvent("modem_message")
- m.setCursorPos(1,4)
- m.setTextColor(colors.white)
- m.write("Energy Usage:")
- if colors.test(redstone.getBundledInput("back"),colors.purple) == true then
- energy=mess1-message
- else
- energy = mess1
- end
- if energy < 0 then
- m.setTextColor(colors.red)
- else
- m.setTextColor(colors.green)
- m.write(" ")
- end
- m.write(comma_value(math.floor(energy)).."RF/T ")
- modem.close(323)
- end
- function display()
- m.setCursorPos(1,1)
- m.setTextColor(colors.white)
- m.write("Power Status: ")
- if colors.test(redstone.getBundledInput("back"),colors.white) == false
- then
- m.setTextColor(colors.green)
- m.write("Normal ")
- else
- m.setTextColor(colors.red)
- m.write("Critical")
- end
- m.setCursorPos(1,5)
- m.setTextColor(colors.white)
- m.write("Reactor: ")
- if colors.test(redstone.getBundledInput("back"),colors.green) == true then
- m.setTextColor(colors.green)
- m.write("Online ")
- else
- m.setTextColor(colors.red)
- m.write("Offline")
- end
- m.setCursorPos(1,7)
- m.setTextColor(colors.white)
- m.write("Turbine 1: ")
- if colors.test(redstone.getBundledInput("back"),colors.red) == true then
- m.setTextColor(colors.green)
- m.write("Online ")
- else
- m.setTextColor(colors.red)
- m.write("Offline")
- end
- m.setCursorPos(1,8)
- m.setTextColor(colors.white)
- m.write("Turbine 2: ")
- if colors.test(redstone.getBundledInput("back"),colors.lime) == true then
- m.setTextColor(colors.green)
- m.write("Online ")
- else
- m.setTextColor(colors.red)
- m.write("Offline")
- end
- m.setCursorPos(1,9)
- m.setTextColor(colors.white)
- m.write("Turbine 3: ")
- if colors.test(redstone.getBundledInput("back"),colors.blue) == true then
- m.setTextColor(colors.green)
- m.write("Online ")
- else
- m.setTextColor(colors.red)
- m.write("Offline")
- end
- end
- function comma_value(amount)
- local formatted = amount
- local swap = false
- if formatted < 0 then
- formatted = formatted*-1
- swap=true
- end
- while true do
- formatted, k = string.gsub(formatted,"^(%d+)(%d%d%d)",'%1,%2')
- if k == 0 then
- break
- end
- end
- if swap then
- formatted = "-"..formatted
- end
- return formatted
- end
- function check()
- if counter == 30 then
- m.clear()
- counter=0
- end
- end
- while true do
- call()
- powermon()
- display()
- powerpercent()
- powerusage()
- counter=counter+1
- check()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement