Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local reactor1 = peripheral.wrap("BigReactors-Reactor_3")
- local reactor2 = peripheral.wrap("BigReactors-Reactor_4")
- local args = {...}
- if (#args == 0) then
- print("Usage: <command> [arguments]")
- return
- end
- function terminate()
- return
- end
- if (#args ~= 0) then
- local canContinue = true
- for i = 1, #args do
- if (args[i] == nil) then
- canContinue = false
- end
- end
- if (canContinue) then
- term.clear()
- term.setCursorPos(1, 1)
- if (args[1]:lower() == "activate") then
- if (#args == 2) then
- if (args[2] == "1") then
- print("Attempting to activate Reactor [1]")
- reactor1.setActive(true)
- sleep(0.5)
- if (reactor1.getActive()) then
- print("Reactor [1] has been activated")
- else
- print("Reactor [1] was unable to be activated")
- end
- elseif (args[2] == "2") then
- print("Attempting to activate Reactor [2]")
- reactor2.setActive(true)
- sleep(0.5)
- if (reactor2.getActive()) then
- print("Reactor [2] has been activated")
- else
- print("Reactor [2] was unable to be activated")
- end
- else
- print("Reactor ID too high")
- terminate()
- end
- end
- elseif (args[1]:lower() == "deactivate") then
- if (#args == 2) then
- if (args[2] == "1") then
- print("Attempting to deactivate Reactor [1]")
- reactor1.setActive(false)
- sleep(0.5)
- if (not reactor1.getActive()) then
- print("Reactor [1] has been deactivated")
- else
- print("Reactor [1] was unable to be deactivated")
- end
- elseif (args[2] == "2") then
- print("Attempting to deactivate Reactor [2]")
- reactor2.setActive(false)
- sleep(0.5)
- if (not reactor2.getActive()) then
- print("Reactor [2] has been deactivated")
- else
- print("Reactor [2] was unable to be deactivated")
- end
- else
- print("Reactor ID too high")
- terminate()
- end
- end
- else
- print("This command does not exist: \""..args[1].."\"")
- end
- else
- print("A blank or nil argument was supplied")
- terminate()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement