Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --BigReactors Monitor
- --NAPTlME
- --using 4x3 monitor, size 79x38
- rednet.open('right')
- os.loadAPI("button")
- m = peripheral.wrap("left")
- n = peripheral.wrap("BigReactors-Reactor_0")
- p = peripheral.wrap("ep_dialling_device_0")
- c = peripheral.wrap("ep_controller_1")
- m.clear()
- rs.setAnalogOutput('front',0)
- function white()
- m.setBackgroundColor(colors.white)
- w,h = m.getSize()
- for i = 4,h do
- m.setCursorPos(1,i)
- for j = 1,w do
- m.write(" ")
- end
- end
- end
- white()
- function start()
- m.setBackgroundColor(colors.lightBlue)
- for i = 4,25 do
- m.setCursorPos(28,i)
- m.write(" ")
- end
- m.setCursorPos(1,25)
- for i = 1,28 do
- m.write(" ")
- end
- for i = 1,3 do
- m.setCursorPos(1,i)
- for j = 1,w do
- m.write(" ")
- end
- end
- m.setBackgroundColor(colors.white)
- end
- start()
- function fillTable()
- button.setTable("Ocean", ocean, nil, 31,51,4,6)
- button.setTable("Overdrive", overdrive, nil, 3,26,21,23)
- button.setTable("Brain's Base", brain, nil, 54,74,4,6)
- button.screen()
- end
- function getClick()
- event,side,x,y = os.pullEvent("monitor_touch")
- button.checkxy(x,y)
- end
- function ocean()
- button.flash("Ocean")
- white()
- m.clear()
- m.setTextScale(0.75)
- w,h = m.getSize()
- m.setTextColor(colors.black)
- line1 = "Aligning Gateway to Ocean base."
- m.setCursorPos((w-string.len(line1))/2+1,7)
- m.write(line1)
- line2 = "Please make your way to the Gateway and enjoy your stay at RestEasy"
- m.setCursorPos((w-string.len(line2))/2+1,9)
- m.write(line2)
- rs.setOutput('back', true)
- sleep(1)
- rs.setOutput('back', false)
- rednet.send(630, "switch")
- --rednet.send(#, "switch")
- id, msg = rednet.receive(10)
- m.clear()
- m.setTextScale(0.5)
- w,h = m.getSize()
- white()
- start()
- button.heading("Rest Easy: Secure Solutions", "")
- m.setTextColor(colors.black)
- button.screen()
- end
- function brain()
- button.flash("Brain's Base")
- m.setBackgroundColor(colors.white)
- m.clear()
- m.setTextScale(0.75)
- w,h = m.getSize()
- w = w - 28
- m.setTextColor(colors.black)
- line1 = "Aligning Portal to Brain's Base."
- m.setCursorPos((w-string.len(line1))/2+29,7)
- m.write(line1)
- line2 = "Please make your way to the Portal"
- m.setCursorPos((w-string.len(line2))/2+29,9)
- m.write(line2)
- line3 = "And enjoy your stay at RestEasy"
- m.setCursorPos((w-string.len(line3))/2+29,11)
- m.write(line3)
- rs.setAnalogOutput('front',1)
- z = os.pullEvent("monitor_touch")
- rs.setAnalogOutput('front',0)
- m.clear()
- m.setTextScale(0.5)
- w,h = m.getSize()
- white()
- start()
- m.setTextColor(colors.black)
- button.heading("Rest Easy: Secure Solutions", "")
- button.screen()
- end
- function overdrive()
- button.toggleButton("Overdrive")
- rednet.send(73, "overdrive")
- sleep(30)
- button.toggleButton("Overdrive")
- button.screen()
- end
- function test2()
- button.toggleButton("Test2")
- print("Test2")
- end
- function test3()
- print("Test3")
- end
- function test4()
- print("Test4")
- end
- function is_Active()
- if n.getActive() then
- rActive = "Active "
- local x_min = 3
- local x_max = 26
- local x_spot = math.floor((x_max - x_min - string.len(rActive)) /2) +1
- m.setBackgroundColor(colors.white)
- m.setCursorPos(3,8)
- for l = 1, (((x_max - x_min) - string.len(rActive)) +1) do
- if l == x_spot then
- m.write(rActive)
- else
- m.write(" ")
- end
- end
- energy = math.floor(n.getEnergyProducedLastTick() + 0.5)
- rEnergy = "Energy/tick: "..energy
- local x_min= 3
- local x_max = 26
- local x_spot = math.floor((x_max-x_min - string.len(rEnergy))/2) +1
- m.setCursorPos(3,10)
- for l = 0, x_max - x_min - string.len(rEnergy) +1 do
- if l == x_spot then
- m.write(rEnergy)
- else
- m.write(" ")
- end
- end
- rod = n.getControlRodLevel(1)
- rRod = "Fuel Rod Insertion: "..rod.."%"
- local x_min= 3
- local x_max = 26
- local x_spot = math.floor((x_max-x_min - string.len(rRod))/2) +1
- m.setCursorPos(3,12)
- for l = 0, x_max - x_min - string.len(rRod) +1 do
- if l == x_spot then
- m.write(rRod)
- else
- m.write(" ")
- end
- end
- stored = n.getEnergyStored()
- rStored = stored.." RF"
- local x_min= 3
- local x_max = 26
- local x_spot = math.floor((x_max-x_min - string.len(rStored))/2) +1
- m.setCursorPos(3,14)
- for l = 0, x_max - x_min - string.len(rStored) +1 do
- if l == x_spot then
- m.write(rStored)
- else
- m.write(" ")
- end
- end
- else
- rActive = "Idle"
- local x_min = 3
- local x_max = 26
- local x_spot = math.floor((x_max - x_min - string.len(rActive)) /2) +1
- m.setBackgroundColor(colors.white)
- m.setCursorPos(3,8)
- for l = 0, x_max - x_min - string.len(rActive) +1 do
- if l == x_spot then
- m.write(rActive)
- else
- m.write(" ")
- end
- end
- end
- end
- function connected()
- if n.getConnected() then
- rName = "Reactor"
- local x_min = 3
- local x_max = 26
- local x_spot = math.floor((x_max - x_min - string.len(rName)) /2) +1
- m.setBackgroundColor(colors.white)
- m.setCursorPos(3,6)
- for l = 0, x_max - x_min - string.len(rName) +1 do
- if l == x_spot then
- m.write(rName)
- else
- m.write(" ")
- end
- end
- is_Active()
- end
- end
- fillTable()
- button.heading("Rest Easy: Secure Solutions", "")
- --button.label(1,5,"Demo!")
- m.setTextColor(colors.black)
- function touch()
- while true do
- getClick()
- end
- end
- function reactor()
- while true do
- connected()
- sleep(1)
- end
- end
- function main()
- fillTable()
- parallel.waitForAll(touch,reactor)
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement