Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Hardware Variables--
- local m1 = peripheral.wrap("monitor_25")
- local m2 = peripheral.wrap("monitor_3")
- local m3 = peripheral.wrap("monitor_23")
- local m4 = peripheral.wrap("monitor_22")
- local r1 = peripheral.wrap("BigReactors-Reactor_2")
- local t1 = peripheral.wrap("BigReactors-Turbine_1")
- local t2 = peripheral.wrap("BigReactors-Turbine_0")
- --Control Button Toggle --
- function btn(y,state)
- if state == "on" then
- m1.setCursorPos(18,y)
- m1.setBackgroundColor(colors.green)
- m1.write(" ON ")
- m1.setCursorPos(25,y)
- m1.setBackgroundColor(colors.gray)
- m1.write(" OFF ")
- m1.setCursorPos(30,y)
- elseif state == "off" then
- m1.setCursorPos(18,y)
- m1.setBackgroundColor(colors.gray)
- m1.write(" ON ")
- m1.setCursorPos(25,y)
- m1.setBackgroundColor(colors.red)
- m1.write(" OFF ")
- m1.setCursorPos(30,y)
- end
- end
- --Start Program--
- m1.clear()
- --Reactor
- r1.setActive(true)
- m1.setCursorPos(1,1)
- m1.setBackgroundColor(colors.black)
- m1.write("Reactor")
- btn(1,"on")
- --Turbine 1
- t1.setActive(true)
- m1.setCursorPos(1,2)
- m1.setBackgroundColor(colors.black)
- m1.write("Turbine 1")
- btn(2,"on")
- --Turbine 2
- t2.setActive(true)
- m1.setCursorPos(1,3)
- m1.setBackgroundColor(colors.black)
- m1.write("Turbine 2")
- btn(3,"on")
- --Blast door
- redstone.setOutput("top",false)
- m1.setCursorPos(1,5)
- m1.setBackgroundColor(colors.black)
- m1.write("Blast Door")
- btn(5,"off")
- m1.setCursorPos(1,1)
- m1.setBackgroundColor(colors.black)
- while true do
- --Button Press--
- os.startTimer(0.5)
- while true do
- local evt = {os.pullEvent()}
- if evt[1]=="timer" then
- break
- elseif evt[1]=="monitor_touch" then
- local x,y = evt[3],evt[4]
- if evt[2] == "monitor_25" then
- --ON--
- if x>=18 and x<=22 then
- btn(y,"on")
- if y==1 then
- r1.setActive(true)
- elseif y==2 then
- t1.setActive(true)
- elseif y==3 then
- t2.setActive(true)
- elseif y==4 then
- --blank line
- elseif y==5 then
- redstone.setOutput("top",true)
- end
- --OFF--
- elseif x>25 and x<=30 then
- btn(y,"off")
- if y==1 then
- r1.setActive(false)
- elseif y==2 then
- t1.setActive(false)
- elseif y==3 then
- t2.setActive(false)
- elseif y==4 then
- --blank line
- elseif y==5 then
- redstone.setOutput("top",false)
- end
- end
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement