os.loadAPI("ocs/apis/sensor")
rednet.open("back")
local monitor = peripheral.wrap("top")
prox = sensor.wrap("left")
term.clear()

monitor.setBackgroundColor(colors.black)
monitor.clear()
monitor.setTextColor(colors.lightBlue)
monitor.setCursorPos(8,1)
monitor.write("Oxygen Central")
monitor.setTextColor(colors.white)
monitor.setCursorPos(1,3)
monitor.write("Main Control")
monitor.setCursorPos(1,4)
monitor.write("Oxygen Module")
monitor.setCursorPos(1,5)
monitor.write("Right Wing")
monitor.setCursorPos(1,6)
monitor.write("Liquid Store")
monitor.setCursorPos(1,7)
monitor.write("Laboratory")
monitor.setCursorPos(1,8)
monitor.write("Bee Tech")
monitor.setCursorPos(1,9)
monitor.write("Left Wing")
monitor.setCursorPos(1,10)
monitor.write("Refectory")
monitor.setCursorPos(1,11)
monitor.write("Quarters")
monitor.setCursorPos(1,12)
monitor.write("Cartography")
monitor.setCursorPos(1,13)
monitor.write("Nuclear Core")
monitor.setCursorPos(1,14)
monitor.write("Energy Store")
monitor.setCursorPos(1,15)
monitor.write("------------------------------------")
monitor.setCursorPos(6,16)
monitor.setTextColor(colors.orange)
monitor.write("Nuclear Reactor Core")
monitor.setCursorPos(1,18)
monitor.setTextColor(colors.white)
monitor.write("ACTIVE:")
monitor.setCursorPos(1,19)
monitor.write("HEAT:")
term.setCursorPos(1,1)
print("OXYGEN SYSTEMS")

while true do

if rs.getInput("right") == true then 
 monitor.setCursorPos(15,3)
 monitor.setBackgroundColor(colors.lime)
 monitor.write("ON ")
end

if rs.getInput("right") == false then
 monitor.setCursorPos(15,3)
 monitor.setBackgroundColor(colors.red)
 monitor.write("OFF")
end

local id, message = rednet.receive()
if message == "o1" and id == 63 then
 monitor.setCursorPos(15,4)
 monitor.setBackgroundColor(colors.cyan)
 monitor.write("ON ")
end

local id, message = rednet.receive()
if message == "o1n" and id == 63 then
 monitor.setCursorPos(15,4)
 monitor.setBackgroundColor(colors.orange)
 monitor.write("OFF")
end

local id, message = rednet.receive()
if message == "o2" and id == 77 then
 monitor.setCursorPos(15,5)
 monitor.setBackgroundColor(colors.lime)
 monitor.write("ON ")
end

local id, message = rednet.receive()
if message == "o2n" and id == 77 then
 monitor.setCursorPos(15,5)
 monitor.setBackgroundColor(colors.red)
 monitor.write("OFF")
 end

local id, message = rednet.receive()
if message == "o3" and id == 78 then
 monitor.setCursorPos(15,6)
 monitor.setBackgroundColor(colors.cyan)
 monitor.write("ON ")
end

local id, message = rednet.receive()
if message == "o3n" and id == 78 then
 monitor.setCursorPos(15,6)
 monitor.setBackgroundColor(colors.orange)
 monitor.write("OFF")
end

local id, message = rednet.receive()
if message == "o4" and id == 79 then
 monitor.setCursorPos(15,7)
 monitor.setBackgroundColor(colors.lime)
 monitor.write("ON ")
end

local id, message = rednet.receive()
if message == "o4n" and id == 79 then
 monitor.setCursorPos(15,7)
 monitor.setBackgroundColor(colors.red)
 monitor.write("OFF")
end

local id, message = rednet.receive()
if message == "o5" and id == 80 then
 monitor.setCursorPos(15,8)
 monitor.setBackgroundColor(colors.cyan)
 monitor.write("ON ")
end

local id, message = rednet.receive()
if message == "o5n" and id == 80 then
 monitor.setCursorPos(15,8)
 monitor.setBackgroundColor(colors.orange)
 monitor.write("OFF") 
end      

local id, message = rednet.receive()
if message == "o6" and id == 81 then
 monitor.setCursorPos(15,9)
 monitor.setBackgroundColor(colors.lime)
 monitor.write("ON ")
end

local id, message = rednet.receive()
if message == "o6n" and id == 81 then
 monitor.setCursorPos(15,9)
 monitor.setBackgroundColor(colors.red)
 monitor.write("OFF")
end

local id, message = rednet.receive()
if message == "o7" and id == 82 then
 monitor.setCursorPos(15,10)
 monitor.setBackgroundColor(colors.cyan)
 monitor.write("ON ")
end

local id, message = rednet.receive()
if message == "o7n" and id == 82 then
 monitor.setCursorPos(15,10)
 monitor.setBackgroundColor(colors.orange)
 monitor.write("OFF")
end

local id, message = rednet.receive()
if message == "o8" and id == 85 then
 monitor.setCursorPos(15,11)
 monitor.setBackgroundColor(colors.lime)
 monitor.write("ON ")
end

local id, message = rednet.receive()
if message == "o8n" and id == 85 then
 monitor.setCursorPos(15,11)
 monitor.setBackgroundColor(colors.red)
 monitor.write("OFF")
end

local id, message = rednet.receive()
if message == "o9" and id == 86 then
 monitor.setCursorPos(15,12)
 monitor.setBackgroundColor(colors.cyan)
 monitor.write("ON ")
end

local id, message = rednet.receive()
if message == "o9n" and id == 86 then
 monitor.setCursorPos(15,12)
 monitor.setBackgroundColor(colors.orange)
 monitor.write("OFF")
end

local id, message = rednet.receive()
if message == "o10" and id == 87 then
 monitor.setCursorPos(15,13)
 monitor.setBackgroundColor(colors.lime)
 monitor.write("ON ")
end

local id, message = rednet.receive()
if message == "o10n" and id == 87 then
 monitor.setCursorPos(15,13)
 monitor.setBackgroundColor(colors.red)
 monitor.write("OFF")
end

local id, message = rednet.receive()
if message == "o11" and id == 88 then
 monitor.setCursorPos(15,14)
 monitor.setBackgroundColor(colors.cyan)
 monitor.write("ON ")
end

local id, message = rednet.receive()
if message == "o11n" and id == 88 then
 monitor.setCursorPos(15,14)
 monitor.setBackgroundColor(colors.orange)
 monitor.write("OFF")
end

moreDetails = prox.getTargetDetails("6,-8,1")
monitor.setCursorPos(12,18)
monitor.setBackgroundColor(colors.black)
monitor.write(moreDetails.Active)
monitor.setCursorPos(12,19)
monitor.write(moreDetails.Heat)

end

