Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- modem=peripheral.wrap("back")
- modem.open(156)
- pad=0
- -- Fields, as defined in the reactor management program.
- info={"Current energy capacity","Maximum energy capacity","Energy buffer percent","Energy production rate","Fuel usage","Fuel rod level"}
- values={0,0,0,0,0,0}
- units={" RF"," RF","% RF"," RF/t"," buckets per hour","%"}
- function Receive()
- while true do
- local event,side,sch,rch,message,dist=os.pullEvent("modem_message")
- values=textutils.unserialize(message)
- sleep(2.5)
- end
- end
- function Draw()
- while true do
- -- Title
- term.setCursorPos(2,2)
- term.setBackgroundColor(colors.purple)
- term.setTextColor(colors.yellow)
- term.write("NMDanny's Reactor Control v1")
- -- On program first run, check for padding
- if(pad==0) then
- for i=1,#info,1 do
- pad=math.max(pad,#(info[i]..": "..values[i]..units[i]))
- end
- end
- -- Print data
- term.setTextColor(colors.white)
- for i=1,#info,1 do
- term.setCursorPos(2,3+i)
- local tempPad=pad-#(info[i]..": "..values[i]..units[i])
- term.write(info[i]..": "..string.rep(" ",tempPad)..values[i]..units[i])
- end
- sleep(2.5)
- end
- end
- while true do
- parallel.waitForAny(Receive,Draw)
- end
Advertisement
Add Comment
Please, Sign In to add comment