Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- speaker = peripheral.find("speaker")
- modem = peripheral.find("modem")
- criterror = false
- playwarning = false
- term.clear()
- term.setCursorPos(1,1)
- modem.open(1293)
- modem.open(1294)
- speaker.synthesize("Booting Up...")
- print("Future O.S.")
- print("Booting Up...")
- --term.setCursorPos(30,10)
- textutils.slowPrint("#############",6)
- speaker.synthesize("Base Online...")
- term.clear()
- local function createwindows()
- warningwindow = window.create(term.current(),10,5,35,12,false)
- warningwindow.setBackgroundColor(colors.red)
- warningwindow.clear()
- warningwindow.setCursorPos(13,6)
- warningwindow.setTextColor(colors.black)
- reactorwindow = window.create(term.current(),1,1,30,10,true)
- basewindow = window.create(term.current(),31,1,34,15,true)
- basewindow.setBackgroundColor(colors.black)
- reactorwindow.setBackgroundColor(colors.black)
- basewindow.clear()
- reactorwindow.clear()
- basewindow.setCursorPos(1,1)
- basewindow.setTextColor(colors.white)
- reactorwindow.setCursorPos(1,1)
- reactorwindow.setTextColor(colors.white)
- reactorwindow.write("Reactor Status: Unknown")
- end
- local function displaybasestatus(texttopost)
- local xl,yl = basewindow.getCursorPos()
- basewindow.setCursorPos(1,yl + 1)
- basewindow.write(texttopost)
- if(xl + 1 < 15) then
- basewindow.clear()
- basewindow.setCursorPos(1,1)
- end
- end
- local function displayreactor()
- while true do
- reactorstatus = {}
- modem.transmit(1293, 1294, "status")
- local event, modemSide, senderChannel, replyChannel, message, senderDistance = os.pullEvent("modem_message")
- for token in string.gmatch(message, "[^%s]+") do
- table.insert(reactorstatus, token)
- end
- if(oldreactorstatus == nil) then
- displaybasestatus("Reactor Status set to: " .. reactorstatus[3])
- elseif(reactorstatus[3] ~= oldreactorstatus) then
- displaybasestatus("Reactor Status set to: " .. reactorstatus[3])
- end
- reactorwindow.clear()
- reactorwindow.setCursorPos(1,1)
- reactorwindow.setTextColor(colors.white)
- reactorwindow.write("Reactor Status: " .. reactorstatus[3])
- reactorwindow.setCursorPos(1,2)
- if(4000 < tonumber(reactorstatus[1]) and tonumber(reactorstatus[1]) < 6000) then
- reactorwindow.setTextColor(colors.orange)
- elseif(6000 < tonumber(reactorstatus[1]) and tonumber(reactorstatus[1]) < 9200) then
- reactorwindow.setTextColor(colors.red)
- playwarning = false
- elseif(9000 <= tonumber(reactorstatus[1])) then
- reactorwindow.setTextColor(colors.red)
- displaybasestatus("Evacuate the Area Immediantly!!!")
- playwarning = true
- end
- reactorwindow.write("Reactor Heat: " .. reactorstatus[1])
- reactorwindow.setCursorPos(1,3)
- reactorwindow.setTextColor(colors.white)
- reactorwindow.write("Reactor EU Output: " .. reactorstatus[2])
- oldreactorstatus = reactorstatus[3]
- sleep(0)
- end
- end
- local function dummyfunction()
- while true do
- while(playwarning == true) do
- speaker.synthesize("Explosion Imminent, Evacuate the Area Immediantly!")
- os.sleep(3)
- end
- sleep(0)
- end
- end
- createwindows()
- basewindow.write("Started up Systems...")
- while true do
- parallel.waitForAll(displayreactor, dummyfunction)
- sleep(0)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement