//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:31 // The communications computer /obj/machinery/computer/communications name = "command and communications console" desc = "Used to command and control the station. Can relay long-range communications." icon_state = "comm" light_color = "#0099ff" req_access = list(access_heads) circuit = "/obj/item/weapon/circuitboard/communications" var/prints_intercept = 1 var/authenticated = 0 var/list/messagetitle = list() var/list/messagetext = list() var/currmsg = 0 var/aicurrmsg = 0 var/state = STATE_DEFAULT var/aistate = STATE_DEFAULT var/message_cooldown = 0 var/centcomm_message_cooldown = 0 var/tmp_alertlevel = 0 var/const/STATE_DEFAULT = 1 var/const/STATE_CALLSHUTTLE = 2 var/const/STATE_CANCELSHUTTLE = 3 var/const/STATE_MESSAGELIST = 4 var/const/STATE_VIEWMESSAGE = 5 var/const/STATE_DELMESSAGE = 6 var/const/STATE_STATUSDISPLAY = 7 var/const/STATE_ALERT_LEVEL = 8 var/const/STATE_CONFIRM_LEVEL = 9 var/const/STATE_CREWTRANSFER = 10 var/status_display_freq = "1435" var/stat_msg1 var/stat_msg2 var/datum/announcement/priority/crew_announcement = new /obj/machinery/computer/communications/New() ..() crew_announcement.newscast = 1 /obj/machinery/computer/communications/process() if(..()) if(state != STATE_STATUSDISPLAY) src.updateDialog() /obj/machinery/computer/communications/Topic(href, href_list) if(..()) return 1 usr.set_machine(src) if(!href_list["operation"]) return switch(href_list["operation"]) // main interface if("main") src.state = STATE_DEFAULT if("login") var/mob/M = usr var/obj/item/weapon/card/id/I = M.get_active_hand() if (istype(I, /obj/item/device/pda)) var/obj/item/device/pda/pda = I I = pda.id if (I && istype(I)) if(src.check_access(I)) authenticated = 1 //if(access_captain in I.access) //authenticated = 2 crew_announcement.announcer = GetNameAndAssignmentFromId(I) if("logout") authenticated = 0 crew_announcement.announcer = "" if("swipeidseclevel") var/mob/M = usr var/obj/item/weapon/card/id/I = M.get_active_hand() if (istype(I, /obj/item/device/pda)) var/obj/item/device/pda/pda = I I = pda.id if (I && istype(I)) if(access_heads in I.access) //Let heads change the alert level. var/old_level = security_level if(!tmp_alertlevel) tmp_alertlevel = SEC_LEVEL_GREEN if(tmp_alertlevel < SEC_LEVEL_GREEN) tmp_alertlevel = SEC_LEVEL_GREEN if(tmp_alertlevel > SEC_LEVEL_BLUE) tmp_alertlevel = SEC_LEVEL_BLUE //Cannot engage delta with this set_security_level(tmp_alertlevel) if(security_level != old_level) //Only notify the admins if an actual change happened log_game("[key_name(usr)] has changed the security level to [get_security_level()].") message_admins("[key_name_admin(usr)] has changed the security level to [get_security_level()].") switch(security_level) if(SEC_LEVEL_GREEN) feedback_inc("alert_comms_green",1) if(SEC_LEVEL_BLUE) feedback_inc("alert_comms_blue",1) tmp_alertlevel = 0 else: usr << "You are not authorized to do this." tmp_alertlevel = 0 state = STATE_DEFAULT else usr << "You need to swipe your ID." if("announce") if(src.authenticated==1) if(message_cooldown) usr << "Please allow at least one minute to pass between announcements" return var/input = input(usr, "Please write a message to announce to the station crew.", "Priority Announcement") if(!input || !(usr in view(1,src))) return crew_announcement.Announce(input) message_cooldown = 1 spawn(600)//One minute cooldown message_cooldown = 0 if("callshuttle") src.state = STATE_DEFAULT if(src.authenticated) src.state = STATE_CALLSHUTTLE if("callshuttle2") if(src.authenticated) call_shuttle_proc(usr) if(emergency_shuttle.online()) post_status("shuttle") src.state = STATE_DEFAULT if("cancelshuttle") src.state = STATE_DEFAULT if(src.authenticated) src.state = STATE_CANCELSHUTTLE if("cancelshuttle2") if(src.authenticated) cancel_call_proc(usr) src.state = STATE_DEFAULT if("messagelist") src.currmsg = 0 src.state = STATE_MESSAGELIST if("viewmessage") src.state = STATE_VIEWMESSAGE if (!src.currmsg) if(href_list["message-num"]) src.currmsg = text2num(href_list["message-num"]) else src.state = STATE_MESSAGELIST if("delmessage") src.state = (src.currmsg) ? STATE_DELMESSAGE : STATE_MESSAGELIST if("delmessage2") if(src.authenticated) if(src.currmsg) var/title = src.messagetitle[src.currmsg] var/text = src.messagetext[src.currmsg] src.messagetitle.Remove(title) src.messagetext.Remove(text) if(src.currmsg == src.aicurrmsg) src.aicurrmsg = 0 src.currmsg = 0 src.state = STATE_MESSAGELIST else src.state = STATE_VIEWMESSAGE if("status") src.state = STATE_STATUSDISPLAY // Status display stuff if("setstat") switch(href_list["statdisp"]) if("message") post_status("message", stat_msg1, stat_msg2) if("alert") post_status("alert", href_list["alert"]) else post_status(href_list["statdisp"]) if("setmsg1") stat_msg1 = reject_bad_text(sanitize(input("Line 1", "Enter Message Text", stat_msg1) as text|null, 40), 40) src.updateDialog() if("setmsg2") stat_msg2 = reject_bad_text(sanitize(input("Line 2", "Enter Message Text", stat_msg2) as text|null, 40), 40) src.updateDialog() // OMG CENTCOMM LETTERHEAD if("MessageCentcomm") if(src.authenticated==1) if(centcomm_message_cooldown) usr << "Arrays recycling. Please stand by." return if(!is_relay_online())//Contact Centcom has a check, Syndie doesn't to allow for Traitor funs. usr <<"No Emergency Bluespace Relay detected. Unable to transmit message." return var/input = sanitize(input("Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response. There is a 30 second delay before you may send another message, be clear, full and concise.", "To abort, send an empty message.", "")) if(!input || !(usr in view(1,src))) return Centcomm_announce(input, usr) usr << "Message transmitted." log_say("[key_name(usr)] has made an IA Centcomm announcement: [input]") centcomm_message_cooldown = 1 spawn(300)//30 second cooldown centcomm_message_cooldown = 0 // OMG SYNDICATE ...LETTERHEAD if("MessageSyndicate") if((src.authenticated==1) && (src.emagged)) if(centcomm_message_cooldown) usr << "Arrays recycling. Please stand by." return var/input = sanitize(input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response. There is a 30 second delay before you may send another message, be clear, full and concise.", "To abort, send an empty message.", "")) if(!input || !(usr in view(1,src))) return Syndicate_announce(input, usr) usr << "Message transmitted." log_say("[key_name(usr)] has made an illegal announcement: [input]") centcomm_message_cooldown = 1 spawn(300)//10 minute cooldown centcomm_message_cooldown = 0 if("RestoreBackup") usr << "Backup routing data restored!" src.emagged = 0 src.updateDialog() // AI interface if("ai-main") src.aicurrmsg = 0 src.aistate = STATE_DEFAULT if("ai-callshuttle") src.aistate = STATE_CALLSHUTTLE if("ai-callshuttle2") call_shuttle_proc(usr) src.aistate = STATE_DEFAULT if("ai-messagelist") src.aicurrmsg = 0 src.aistate = STATE_MESSAGELIST if("ai-viewmessage") src.aistate = STATE_VIEWMESSAGE if (!src.aicurrmsg) if(href_list["message-num"]) src.aicurrmsg = text2num(href_list["message-num"]) else src.aistate = STATE_MESSAGELIST if("ai-delmessage") src.aistate = (src.aicurrmsg) ? STATE_DELMESSAGE : STATE_MESSAGELIST if("ai-delmessage2") if(src.aicurrmsg) var/title = src.messagetitle[src.aicurrmsg] var/text = src.messagetext[src.aicurrmsg] src.messagetitle.Remove(title) src.messagetext.Remove(text) if(src.currmsg == src.aicurrmsg) src.currmsg = 0 src.aicurrmsg = 0 src.aistate = STATE_MESSAGELIST if("ai-status") src.aistate = STATE_STATUSDISPLAY if("securitylevel") src.tmp_alertlevel = text2num( href_list["newalertlevel"] ) if(!tmp_alertlevel) tmp_alertlevel = 0 state = STATE_CONFIRM_LEVEL if("changeseclevel") state = STATE_ALERT_LEVEL src.updateUsrDialog() /obj/machinery/computer/communications/attackby(var/obj/I as obj, var/mob/user as mob) if(istype(I,/obj/item/weapon/card/emag/)) src.emagged = 1 user << "You scramble the communication routing circuits!" ..() /obj/machinery/computer/communications/attack_ai(var/mob/user as mob) return src.attack_hand(user) /obj/machinery/computer/communications/attack_hand(var/mob/user as mob) if(..()) return user.set_machine(src) var/dat = "Communications Console" if (emergency_shuttle.has_eta()) var/timeleft = emergency_shuttle.estimate_arrival_time() dat += "Emergency shuttle\n
\nETA: [timeleft / 60 % 60]:[add_zero(num2text(timeleft % 60), 2)]
" if (istype(user, /mob/living/silicon)) var/dat2 = src.interact_ai(user) // give the AI a different interact proc to limit its access if(dat2) dat += dat2 user << browse(dat, "window=communications;size=400x500") onclose(user, "communications") return switch(src.state) if(STATE_DEFAULT) if (src.authenticated) dat += "
\[ Log Out \]" if (src.authenticated==1) dat += "
\[ Make An Announcement \]" if(src.emagged == 0) dat += "
\[ Send an emergency message to Centcomm \]" else dat += "
\[ Send an emergency message to \[UNKNOWN\] \]" dat += "
\[ Restore Backup Routing Data \]" dat += "
\[ Change alert level \]" if(emergency_shuttle.location()) if (emergency_shuttle.online()) dat += "
\[ Cancel Shuttle Call \]" else dat += "
\[ Call Emergency Shuttle \]" dat += "
\[ Set Status Display \]" else dat += "
\[ Log In \]" dat += "
\[ Message List \]" if(STATE_CALLSHUTTLE) dat += "Are you sure you want to call the shuttle? \[ OK | Cancel \]" if(STATE_CANCELSHUTTLE) dat += "Are you sure you want to cancel the shuttle? \[ OK | Cancel \]" if(STATE_MESSAGELIST) dat += "Messages:" for(var/i = 1; i<=src.messagetitle.len; i++) dat += "
[src.messagetitle[i]]" if(STATE_VIEWMESSAGE) if (src.currmsg) dat += "[src.messagetitle[src.currmsg]]

[src.messagetext[src.currmsg]]" if (src.authenticated) dat += "

\[ Delete \]" else src.state = STATE_MESSAGELIST src.attack_hand(user) return if(STATE_DELMESSAGE) if (src.currmsg) dat += "Are you sure you want to delete this message? \[ OK | Cancel \]" else src.state = STATE_MESSAGELIST src.attack_hand(user) return if(STATE_STATUSDISPLAY) dat += "Set Status Displays
" dat += "\[ Clear \]
" dat += "\[ Station Time \]
" dat += "\[ Shuttle ETA \]
" dat += "\[ Message \]" dat += "
" dat += "\[ Alert: None |" dat += " Red Alert |" dat += " Lockdown |" dat += " Biohazard \]

" if(STATE_ALERT_LEVEL) dat += "Current alert level: [get_security_level()]
" if(security_level == SEC_LEVEL_DELTA) dat += "The self-destruct mechanism is active. Find a way to deactivate the mechanism to lower the alert level or evacuate." else dat += "Blue
" dat += "Green" if(STATE_CONFIRM_LEVEL) dat += "Current alert level: [get_security_level()]
" dat += "Confirm the change to: [num2seclevel(tmp_alertlevel)]
" dat += "Swipe ID to confirm change.
" dat += "
\[ [(src.state != STATE_DEFAULT) ? "Main Menu | " : ""]Close \]" user << browse(dat, "window=communications;size=400x500") onclose(user, "communications") /obj/machinery/computer/communications/proc/interact_ai(var/mob/living/silicon/ai/user as mob) var/dat = "" switch(src.aistate) if(STATE_DEFAULT) if(emergency_shuttle.location() && !emergency_shuttle.online()) dat += "
\[ Call Emergency Shuttle \]" dat += "
\[ Message List \]" dat += "
\[ Set Status Display \]" if(STATE_CALLSHUTTLE) dat += "Are you sure you want to call the shuttle? \[ OK | Cancel \]" if(STATE_MESSAGELIST) dat += "Messages:" for(var/i = 1; i<=src.messagetitle.len; i++) dat += "
[src.messagetitle[i]]" if(STATE_VIEWMESSAGE) if (src.aicurrmsg) dat += "[src.messagetitle[src.aicurrmsg]]

[src.messagetext[src.aicurrmsg]]" dat += "

\[ Delete \]" else src.aistate = STATE_MESSAGELIST src.attack_hand(user) return null if(STATE_DELMESSAGE) if(src.aicurrmsg) dat += "Are you sure you want to delete this message? \[ OK | Cancel \]" else src.aistate = STATE_MESSAGELIST src.attack_hand(user) return if(STATE_STATUSDISPLAY) dat += "Set Status Displays
" dat += "\[ Clear \]
" dat += "\[ Station Time \]
" dat += "\[ Shuttle ETA \]
" dat += "\[ Message \]" dat += "
" dat += "\[ Alert: None |" dat += " Red Alert |" dat += " Lockdown |" dat += " Biohazard \]

" dat += "
\[ [(src.aistate != STATE_DEFAULT) ? "Main Menu | " : ""]Close \]" return dat /proc/enable_prison_shuttle(var/mob/user) for(var/obj/machinery/computer/prison_shuttle/PS in world) PS.allowedtocall = !(PS.allowedtocall) /proc/call_shuttle_proc(var/mob/user) if ((!( ticker ) || !emergency_shuttle.location())) return if(!universe.OnShuttleCall(usr)) user << "Cannot establish a bluespace connection." return if(deathsquad.deployed) user << "Centcom will not allow the shuttle to be called. Consider all contracts terminated." return if(emergency_shuttle.deny_shuttle) user << "The emergency shuttle may not be sent at this time. Please try again later." return if(world.time < 6000) // Ten minute grace period to let the game get going without lolmetagaming. -- TLE user << "The emergency shuttle is refueling. Please wait another [round((6000-world.time)/600)] minute\s before trying again." return if(emergency_shuttle.going_to_centcom()) user << "The emergency shuttle may not be called while returning to CentCom." return if(emergency_shuttle.online()) user << "The emergency shuttle is already on its way." return if(ticker.mode.name == "blob") user << "Under directive 7-10, [station_name()] is quarantined until further notice." return emergency_shuttle.call_evac() log_game("[key_name(user)] has called the shuttle.") message_admins("[key_name_admin(user)] has called the shuttle.", 1) return /proc/init_shift_change(var/mob/user, var/force = 0) if ((!( ticker ) || !emergency_shuttle.location())) return if(emergency_shuttle.going_to_centcom()) user << "The shuttle may not be called while returning to CentCom." return if(emergency_shuttle.online()) user << "The shuttle is already on its way." return // if force is 0, some things may stop the shuttle call if(!force) if(emergency_shuttle.deny_shuttle) user << "Centcom does not currently have a shuttle available in your sector. Please try again later." return if(deathsquad.deployed == 1) user << "Centcom will not allow the shuttle to be called. Consider all contracts terminated." return if(world.time < 54000) // 30 minute grace period to let the game get going user << "The shuttle is refueling. Please wait another [round((54000-world.time)/60)] minutes before trying again." return if(ticker.mode.auto_recall_shuttle) //New version pretends to call the shuttle but cause the shuttle to return after a random duration. emergency_shuttle.auto_recall = 1 if(ticker.mode.name == "blob" || ticker.mode.name == "epidemic") user << "Under directive 7-10, [station_name()] is quarantined until further notice." return emergency_shuttle.call_transfer() //delay events in case of an autotransfer if (isnull(user)) event_manager.delay_events(EVENT_LEVEL_MODERATE, 9000) //15 minutes event_manager.delay_events(EVENT_LEVEL_MAJOR, 9000) log_game("[user? key_name(user) : "Autotransfer"] has called the shuttle.") message_admins("[user? key_name_admin(user) : "Autotransfer"] has called the shuttle.", 1) return /proc/cancel_call_proc(var/mob/user) if (!( ticker ) || !emergency_shuttle.can_recall()) return if((ticker.mode.name == "blob")||(ticker.mode.name == "Meteor")) return if(!emergency_shuttle.going_to_centcom()) //check that shuttle isn't already heading to centcomm emergency_shuttle.recall() log_game("[key_name(user)] has recalled the shuttle.") message_admins("[key_name_admin(user)] has recalled the shuttle.", 1) return /proc/is_relay_online() for(var/obj/machinery/bluespacerelay/M in world) if(M.stat == 0) return 1 return 0 /obj/machinery/computer/communications/proc/post_status(var/command, var/data1, var/data2) var/datum/radio_frequency/frequency = radio_controller.return_frequency(1435) if(!frequency) return var/datum/signal/status_signal = new status_signal.source = src status_signal.transmission_method = 1 status_signal.data["command"] = command switch(command) if("message") status_signal.data["msg1"] = data1 status_signal.data["msg2"] = data2 log_admin("STATUS: [src.fingerprintslast] set status screen message with [src]: [data1] [data2]") //message_admins("STATUS: [user] set status screen with [PDA]. Message: [data1] [data2]") if("alert") status_signal.data["picture_state"] = data1 frequency.post_signal(src, status_signal) /obj/machinery/computer/communications/Destroy() for(var/obj/machinery/computer/communications/commconsole in world) if(istype(commconsole.loc,/turf) && commconsole != src) return ..() for(var/obj/item/weapon/circuitboard/communications/commboard in world) if(istype(commboard.loc,/turf) || istype(commboard.loc,/obj/item/weapon/storage)) return ..() for(var/mob/living/silicon/ai/shuttlecaller in player_list) if(!shuttlecaller.stat && shuttlecaller.client && istype(shuttlecaller.loc,/turf)) return ..() if(ticker.mode.name == "revolution" || deathsquad.deployed) return ..() emergency_shuttle.call_evac() log_game("All the AIs, comm consoles and boards are destroyed. Shuttle called.") message_admins("All the AIs, comm consoles and boards are destroyed. Shuttle called.", 1) ..() /obj/item/weapon/circuitboard/communications/Destroy() for(var/obj/machinery/computer/communications/commconsole in world) if(istype(commconsole.loc,/turf)) return ..() for(var/obj/item/weapon/circuitboard/communications/commboard in world) if((istype(commboard.loc,/turf) || istype(commboard.loc,/obj/item/weapon/storage)) && commboard != src) return ..() for(var/mob/living/silicon/ai/shuttlecaller in player_list) if(!shuttlecaller.stat && shuttlecaller.client && istype(shuttlecaller.loc,/turf)) return ..() if(ticker.mode.name == "revolution" || deathsquad.deployed) return ..() emergency_shuttle.call_evac() log_game("All the AIs, comm consoles and boards are destroyed. Shuttle called.") message_admins("All the AIs, comm consoles and boards are destroyed. Shuttle called.", 1) ..()