Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- This program is for the Computercraft mod.
- It allows you to monitor the performance of the reactor from the Draconic Evolution mod.
- Instructions:
- Put the computer back to the reactor stabilizer,
- connect the input and output gates,
- connect the 5x4 blocks monitor.
- click on computer,
- write the command : pastebin get F6mkHf8A start_program
- And Enter the command: start_program
- Tutorial: https://youtu.be/SVl8znXLEPo
- Version 1.0 by OFgRc
- ]]
- --- load
- local mon = peripheral.find("monitor")
- term.redirect(mon)
- local RA = peripheral.wrap("back")
- local RI = RA.getReactorInfo()
- local function RI_RE()
- RI = RA.getReactorInfo()
- end
- local r_s = true
- local fl = io.open("on.nfp","w")
- fl:write(" 111e111\n 11011101110\ne1111e1011e10\n0111001010111\n11e111111001e\ne111011eee111\n1011011111011\n 11e1101e111\n 1110001")
- fl:close()
- fl = io.open("off.nfp","w")
- fl:write(" fffffff\n fffeeefffef\nffffffeefffff\nfffffffffffff\nfefffffffefff\nfffffffffeeff\nffffeefffffff\n fffffffffff\n fffeeef")
- fl:close()
- fl = io.open("charge.nfp","w")
- fl:write(" bbbbbbb\n bbb3b99bbbb\nbbbbbbbbbbb3b\n3b9bbbbbbbbb9\n9bbb3bbb99bb9\nbbbbbbbbbbbb9\nbb99bbbb33bbb\n bbbb3bbbbbb\n 3bbbbb9")
- fl:close()
- fl = io.open("warn.nfp","w")
- fl:write(" 0000100\n 000a0000a0e\n0000000100000\na0100000000a0\n0e01011100000\n101000a000100\n0000000100000\n 00a00000a00\n 0001e00")
- fl:close()
- --vars
- local page = 1
- local bp = "nill"
- local sbp = true
- local ProgramVersion = "1.0"
- local status = RI["status"]
- local img_on = paintutils.loadImage("on.nfp")
- local img_charge = paintutils.loadImage("charge.nfp")
- local img_off = paintutils.loadImage("off.nfp")
- local img_warn = paintutils.loadImage("warn.nfp")
- local t_line
- local s_line
- local e_line
- local c_line
- local output_gate,input_gate = peripheral.find("flux_gate")
- --functions
- local function ev(b,st)
- os.startTimer(1)
- local event,button,x,y = os.pullEvent()
- if event == "monitor_touch" then
- if page == 1 then
- if st == "warming_up" or st == "running" then
- if x >= 38 and y >= 18 and x <= 46 and y <= 19 then
- RA.stopReactor()
- end
- elseif b == "start" then
- if x >= 25 and y >= 18 and x <= 33 and y <= 19 then
- RA.chargeReactor()
- end
- end
- if b == "active" then
- if x >= 25 and y >= 18 and x <= 33 and y <= 19 then
- RA.activateReactor()
- end
- end
- end
- end
- end
- local function clearAll()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- paintutils.drawPixel(1,1,colors.black)
- term.setCursorPos(1,1)
- term.clear()
- end
- local function default()
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.setCursorPos(1,1)
- end
- local function gFP()
- return(math.floor((RI["fieldStrength"] / RI["maxFieldStrength"]) * 10000 + 0.5) / 10000)
- end
- local function gEP()
- return(math.floor((RI["energySaturation"] / RI["maxEnergySaturation"]) * 10000 + 0.5) / 10000)
- end
- local function gFC()
- return(math.floor((RI["fuelConversion"] / RI["maxFuelConversion"]) * 10000 + 0.5) / 10000)
- end
- local FP = gFP()
- local EP = gEP()
- local FC = gFC()
- local function drawAll()
- clearAll()
- status = RI["status"]
- paintutils.drawFilledBox(2,2,19,14,colors.gray)
- term.setCursorPos(4,2)
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- term.write(" STATUS ")
- term.setTextColor(colors.white)
- paintutils.drawBox(21,2,49,14,colors.gray)
- term.setCursorPos(23,2)
- term.setBackgroundColor(colors.black)
- term.write(" INFO ")
- paintutils.drawBox(2,16,49,25,colors.gray)
- term.setCursorPos(4,16)
- term.setBackgroundColor(colors.black)
- term.write(" CONTROLS ")
- paintutils.drawLine(29,4,38,4,colors.gray)
- term.setCursorPos(23,4)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.orange)
- term.write("Temp.")
- term.setCursorPos(40,4)
- term.write(RI["temperature"].."C")
- paintutils.drawLine(29,6,38,6,colors.gray)
- term.setCursorPos(23,6)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.lightBlue)
- term.write("Field")
- term.setCursorPos(40,6)
- term.write((tostring(FP * 100).."%"))
- paintutils.drawLine(29,8,38,8,colors.gray)
- term.setCursorPos(23,8)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.green)
- term.write("Energ.")
- term.setCursorPos(40,8)
- term.write((tostring(EP * 100).."%"))
- paintutils.drawLine(29,10,38,10,colors.gray)
- term.setCursorPos(23,10)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.write("Conv.")
- term.setCursorPos(40,10)
- term.write((tostring(FC * 100).."%"))
- term.setCursorPos(22,12)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.red)
- term.write("Generation Rate:"..RI["generationRate"].."rf/t")
- default()
- term.setTextColor(colors.gray)
- term.write("status: ".. status)
- term.setCursorPos(30,26)
- term.write("Version "..ProgramVersion.." by OFgRc")
- if status == "cold" then
- paintutils.drawImage(img_off,4,4)
- elseif status == "warming_up" or status == "cooling" then
- paintutils.drawImage(img_charge,4,4)
- elseif status == "running" or status == "stopping" then
- paintutils.drawImage(img_on,4,4)
- elseif status == "beyond_hope" then
- paintutils.drawImage(img_warn,4,4)
- end
- local rt = RI["temperature"]
- local n = -1
- if rt > 0 then n = n +1 end
- if rt >= 1111 then n = n +1 end
- if rt >= 2222 then n = n + 1 end
- if rt >= 3333 then n = n + 1 end
- if rt >= 4444 then n = n + 1 end
- if rt >= 5555 then n = n + 1 end
- if rt >= 6666 then n = n + 1 end
- if rt >= 7777 then n = n + 1 end
- if rt >= 8888 then n = n + 1 end
- if rt >= 9999 then n = n + 1 end
- n = 29 + n
- if n > 29 then
- paintutils.drawLine(29,4,n,4,colors.orange) end
- n = -1
- rt = FP * 100
- if rt > 0 then n = n + 1 end
- if rt >= 11 then n = n + 1 end
- if rt >= 22 then n = n + 1 end
- if rt >= 33 then n = n + 1 end
- if rt >= 44 then n = n + 1 end
- if rt >= 55 then n = n + 1 end
- if rt >= 66 then n = n + 1 end
- if rt >= 77 then n = n + 1 end
- if rt >= 88 then n = n + 1 end
- if rt >= 99 then n = n + 1 end
- n = 29 + n
- if n > 29 then
- paintutils.drawLine(29,6,n,6,colors.lightBlue) end
- n = -1
- rt = EP * 100
- if rt > 0 then n = n+1 end
- if rt >= 11 then n = n+1 end
- if rt >= 22 then n = n+1 end
- if rt >= 33 then n = n+1 end
- if rt >= 44 then n = n+1 end
- if rt >= 55 then n = n+1 end
- if rt >= 66 then n = n+1 end
- if rt >= 77 then n = n+1 end
- if rt >= 88 then n = n+1 end
- if rt >= 99 then n = n+1 end
- n = 29 +n
- if n > 29 then
- paintutils.drawLine(29,8,n,8,colors.green) end
- n = -1
- rt = FC * 100
- if rt > 0 then n = n+1 end
- if rt >= 11 then n = n+1 end
- if rt >= 22 then n = n+1 end
- if rt >= 33 then n = n+1 end
- if rt >= 44 then n = n+1 end
- if rt >= 55 then n = n+1 end
- if rt >= 66 then n = n+1 end
- if rt >= 77 then n = n+1 end
- if rt >= 88 then n = n+1 end
- if rt >= 99 then n = n+1 end
- n = 29 + n
- if n > 29 then
- paintutils.drawLine(29,10,n,10,colors.white) end
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.blue)
- term.setCursorPos(4,18)
- term.write("Shield Flow:")
- term.setCursorPos(4,19)
- term.write(input_gate.getFlow() .. "rf/t")
- term.setTextColor(colors.orange)
- term.setCursorPos(4,21)
- term.write("Geniration Flow:")
- term.setCursorPos(4,22)
- term.write(output_gate.getFlow() .. "rf/t")
- default()
- if redstone.getInput("front") == true then
- r_s = false
- end
- default()
- if page == 1 then
- if status == "cold" or status == "cooling" then
- bp = "start"
- elseif RI["temperature"] > 1999 and status == "warming_up" then
- bp = "active"
- elseif status == "stopping" then
- bp = "active"
- else
- bp = "nill"
- end
- if status == "warming_up" or status == "running" then
- paintutils.drawFilledBox(38,18,46,19,colors.red)
- term.setCursorPos(38,18)
- term.write(" Stop")
- term.setCursorPos(38,19)
- term.write(" Reactor")
- end
- if bp == "start" then
- paintutils.drawFilledBox(25,18,33,19,colors.blue)
- term.setCursorPos(25,18)
- term.write(" Start")
- term.setCursorPos(25,19)
- term.write(" Reactor")
- end
- if bp == "active" then
- paintutils.drawFilledBox(25,18,33,19,colors.lime)
- term.setCursorPos(25,18)
- term.write(" Run")
- term.setCursorPos(25,19)
- term.write(" Reactor")
- end
- end
- ev(bp,status)
- end
- --run
- clearAll()
- while r_s == true do
- RI_RE()
- EP = gEP()
- FP = gFP()
- FC = gFC()
- drawAll()
- sleep(0.1)
- end
Add Comment
Please, Sign In to add comment