Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Peripherals
- r1 = peripheral.wrap("BigReactors-Reactor_1")
- r2 = peripheral.wrap("BigReactors-Reactor_2")
- r3 = peripheral.wrap("BigReactors-Reactor_3")
- r4 = peripheral.wrap("BigReactors-Reactor_4")
- --Functions
- function getInput()
- shell.run("clear")
- print("> ")
- input = io.read()
- parseInput(input)
- end
- ------
- function parseInput(input)
- shell.run("clear")
- if input == "override" then
- print("What reactor would you like to toggle manual override for? [1-4]: ")
- reactnum = io.read()
- if reactnum == 1 then
- man1 = true
- elseif reactnum == 2 then
- man2 = true
- elseif reactnum == 3 then
- man3 = true
- elseif reactnum == 4 then
- man4 = true
- end
- elseif input == "auto" then
- print("Which reactor would you like to turn back to auto? [1-4 / all]: ")
- reactnum = io.read()
- if reactnum == all then
- man1 = false
- man2 = false
- man3 = false
- man4 = false
- elseif reactnum == 1 then
- man1 = false
- elseif reactnum == 2 then
- man2 = false
- elseif reactnum == 3 then
- man3 = false
- elseif reactnum == 4 then
- man4 = false
- end
- elseif input == "on" then
- print("Which reactor would you like to manually turn on? [1-4]: ")
- reactnum = io.read()
- if reactnum == 1 then
- if man1 then
- if r1.getActive() then
- print("Reactor 1 is already on!")
- else
- print("Activating Reactor 1!")
- r1.setActive(true)
- if r1.getActive() then
- print("Reactor 1 is ON!")
- end
- end
- else
- print("Reactor 1 is on automatic mode. Please turn it to manual before preforming this command.")
- end
- elseif reactnum == 2 then
- if man2 then
- if r2.getActive() then
- print("Reactor 2 is already on!")
- else
- print("Activating Reactor 2!")
- r2.setActive(true)
- if r2.getActive() then
- print("Reactor 2 is ON!")
- end
- end
- else
- print("Reactor 2 is on automatic mode. Please turn it to manual before preforming this command.")
- end
- elseif reactnum == 3 then
- if man3 then
- if r3.getActive() then
- print("Reactor 3 is already on!")
- else
- print("Activating Reactor 3!")
- r3.setActive(true)
- if r3.getActive() then
- print("Reactor 3 is ON!")
- end
- end
- else
- print("Reactor 3 is on automatic mode. Please turn it to manual before preforming this command.")
- end
- elseif reactnum == 4 then
- if man4 then
- if r4.getActive() then
- print("Reactor 4 is already on!")
- else
- print("Activating Reactor 4!")
- r4.setActive(true)
- if r4.getActive() then
- print("Reactor 4 is ON!")
- end
- end
- else
- print("Reactor 4 is on automatic mode. Please turn it to manual before preforming this command.")
- end
- end
- else if input == "off" then
- print("Which reactor would you like to manually turn off? [1-4]: ")
- reactnum = io.read()
- if reactnum == 1 then
- if man1 then
- if r1.getActive() == false then
- print("Reactor 1 is already off!")
- else
- print("Turning off Reactor 1!")
- r1.setActive(false)
- if r1.getActive() == false then
- print("Reactor 1 is OFF!")
- end
- end
- else
- print("Reactor 1 is on automatic mode. Please turn it to manual before preforming this command.")
- end
- elseif reactnum == 2 then
- if man2 then
- if r2.getActive() == false then
- print("Reactor 2 is already off!")
- else
- print("Turning off Reactor 2!")
- r2.setActive(false)
- if r2.getActive() == false then
- print("Reactor 2 is OFF!")
- end
- end
- else
- print("Reactor 2 is on automatic mode. Please turn it to manual before preforming this command.")
- end
- elseif reactnum == 3 then
- if man3 then
- if r3.getActive() == false then
- print("Reactor 3 is already off!")
- else
- print("Turning off Reactor 3!")
- r3.setActive(false)
- if r3.getActive() == false then
- print("Reactor 3 is OFF!")
- end
- end
- else
- print("Reactor 3 is on automatic mode. Please turn it to manual before preforming this command.")
- end
- elseif reactnum == 4 then
- if man4 then
- if r4.getActive() == false then
- print("Reactor 4 is already off!")
- else
- print("Turning off Reactor 4!")
- r4.setActive(false)
- if r4.getActive() == false then
- print("Reactor 4 is ON!")
- end
- end
- else
- print("Reactor 4 is on automatic mode. Please turn it to manual before preforming this command.")
- end
- end
- end
- end
- end
- while true do
- getInput()
- end
Advertisement
Add Comment
Please, Sign In to add comment