diff --git a/code/__DEFINES/machines.dm b/code/__DEFINES/machines.dm index f7b7790b714..6bb3aa78b61 100644 --- a/code/__DEFINES/machines.dm +++ b/code/__DEFINES/machines.dm @@ -76,3 +76,7 @@ #define AIR_ALARM_FRAME 0 #define AIR_ALARM_UNWIRED 1 #define AIR_ALARM_READY 2 + +#define NUKE_STATUS_INTACT 0 +#define NUKE_CORE_MISSING 1 +#define NUKE_MISSING 2 diff --git a/code/game/gamemodes/game_mode.dm b/code/game/gamemodes/game_mode.dm index 2a3e4434aad..3d8274eed18 100644 --- a/code/game/gamemodes/game_mode.dm +++ b/code/game/gamemodes/game_mode.dm @@ -1,6 +1,3 @@ -#define NUKE_INTACT 0 -#define NUKE_CORE_MISSING 1 -#define NUKE_MISSING 2 /* * GAMEMODES (by Rastaf0) * @@ -404,7 +401,7 @@ if(is_station_level(bomb.z)) nuke_status = NUKE_CORE_MISSING if(bomb.core) - nuke_status = NUKE_INTACT + nuke_status = NUKE_STATUS_INTACT return nuke_status /datum/game_mode/proc/replace_jobbanned_player(mob/living/M, role_type) @@ -508,7 +505,3 @@ var/datum/atom_hud/antag/antaghud = GLOB.huds[ANTAG_HUD_EVENTMISC] antaghud.leave_hud(mob_mind.current) set_antag_hud(mob_mind.current, null) - -#undef NUKE_INTACT -#undef NUKE_CORE_MISSING -#undef NUKE_MISSING diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 6d36eca12d2..b8c74da9470 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -1,15 +1,19 @@ #define COMM_SCREEN_MAIN 1 #define COMM_SCREEN_STAT 2 #define COMM_SCREEN_MESSAGES 3 +#define COMM_SCREEN_ANNOUNCER 4 #define COMM_AUTHENTICATION_NONE 0 #define COMM_AUTHENTICATION_HEAD 1 #define COMM_AUTHENTICATION_CAPT 2 -#define COMM_AUTHENTICATION_AGHOST 3 +#define COMM_AUTHENTICATION_CENTCOM 3 // Admin-only access +#define COMM_AUTHENTICATION_AGHOST 4 #define COMM_MSGLEN_MINIMUM 6 #define COMM_CCMSGLEN_MINIMUM 20 +#define ADMIN_CHECK(user) ((check_rights_all(R_ADMIN|R_EVENT, FALSE, user) && authenticated >= COMM_AUTHENTICATION_CENTCOM) || user.can_admin_interact()) + // The communications computer /obj/machinery/computer/communications name = "communications console" @@ -30,7 +34,6 @@ var/message_cooldown var/centcomm_message_cooldown var/alert_level_cooldown = 0 - var/tmp_alertlevel = 0 var/stat_msg1 var/stat_msg2 @@ -41,6 +44,10 @@ light_color = LIGHT_COLOR_LIGHTBLUE + var/list/cc_announcement_sounds = list("Beep" = 'sound/misc/notice2.ogg', + "Enemy Communications Intercepted" = 'sound/AI/intercept.ogg', + "New Command Report Created" = 'sound/AI/commandreport.ogg') + /obj/machinery/computer/communications/New() GLOB.shuttle_caller_list += src ..() @@ -51,6 +58,8 @@ /obj/machinery/computer/communications/proc/is_authenticated(mob/user, message = 1) if(user.can_admin_interact()) return COMM_AUTHENTICATION_AGHOST + if(ADMIN_CHECK(user)) + return COMM_AUTHENTICATION_CENTCOM if(authenticated == COMM_AUTHENTICATION_CAPT) return COMM_AUTHENTICATION_CAPT if(authenticated) @@ -59,147 +68,155 @@ to_chat(user, "Access denied.") return COMM_AUTHENTICATION_NONE -/obj/machinery/computer/communications/proc/change_security_level(new_level) - tmp_alertlevel = new_level +/obj/machinery/computer/communications/proc/change_security_level(new_level, force) var/old_level = SSsecurity_level.get_current_level_as_number() - 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 - SSsecurity_level.set_level(tmp_alertlevel) + if(!force) + new_level = clamp(new_level, SEC_LEVEL_GREEN, SEC_LEVEL_BLUE) + SSsecurity_level.set_level(new_level) if(SSsecurity_level.get_current_level_as_number() != old_level) //Only notify the admins if an actual change happened log_game("[key_name(usr)] has changed the security level to [SSsecurity_level.get_current_level_as_text()].") message_admins("[key_name_admin(usr)] has changed the security level to [SSsecurity_level.get_current_level_as_text()].") - tmp_alertlevel = 0 + if(new_level == SEC_LEVEL_EPSILON) + // episilon is delayed... but we still want to log it + log_game("[key_name(usr)] has changed the security level to epsilon.") + message_admins("[key_name_admin(usr)] has changed the security level to epsilon.") -/obj/machinery/computer/communications/ui_act(action, params) +/obj/machinery/computer/communications/ui_act(action, params, datum/tgui/ui) if(..()) return if(!is_secure_level(z)) - to_chat(usr, "Unable to establish a connection: You're too far away from the station!") + to_chat(ui.user, "Unable to establish a connection: You're too far away from the station!") return . = TRUE if(action == "auth") - if(!ishuman(usr)) - to_chat(usr, "Access denied, no humanoid lifesign detected.") + if(!ishuman(ui.user)) + to_chat(ui.user, "Access denied, no humanoid lifesign detected.") return FALSE // Logout function. if(authenticated != COMM_AUTHENTICATION_NONE) authenticated = COMM_AUTHENTICATION_NONE announcer.author = null - setMenuState(usr, COMM_SCREEN_MAIN) + setMenuState(ui.user, COMM_SCREEN_MAIN) return // Login function. - var/list/access = usr.get_access() - if(allowed(usr)) + var/list/access = ui.user.get_access() + if(allowed(ui.user)) authenticated = COMM_AUTHENTICATION_HEAD if(ACCESS_CAPTAIN in access) authenticated = COMM_AUTHENTICATION_CAPT - var/mob/living/carbon/human/H = usr + if(ACCESS_CENT_COMMANDER in access) + if(!check_rights_all(R_ADMIN|R_EVENT, FALSE, ui.user)) + to_chat(ui.user, "[src] buzzes, invalid central command clearance.") + return + authenticated = COMM_AUTHENTICATION_CENTCOM + + if(authenticated >= COMM_AUTHENTICATION_CAPT) + var/mob/living/carbon/human/H = ui.user + if(!istype(H)) + return var/obj/item/card/id = H.get_idcard(TRUE) if(istype(id)) announcer.author = GetNameAndAssignmentFromId(id) if(authenticated == COMM_AUTHENTICATION_NONE) - to_chat(usr, "You need to wear a command or Captain-level ID.") + to_chat(ui.user, "You need to wear a command or Captain-level ID.") return // All functions below this point require authentication. - if(!is_authenticated(usr)) + if(!is_authenticated(ui.user)) return FALSE switch(action) if("main") - setMenuState(usr, COMM_SCREEN_MAIN) + setMenuState(ui.user, COMM_SCREEN_MAIN) if("newalertlevel") - if(isAI(usr) || isrobot(usr)) - to_chat(usr, "Firewalls prevent you from changing the alert level.") + if(isAI(ui.user) || isrobot(ui.user)) + to_chat(ui.user, "Firewalls prevent you from changing the alert level.") return - else if(usr.can_admin_interact()) - change_security_level(text2num(params["level"])) + else if(ADMIN_CHECK(ui.user)) + change_security_level(text2num(params["level"]), force = TRUE) return - else if(!ishuman(usr)) - to_chat(usr, "Security measures prevent you from changing the alert level.") + else if(!ishuman(ui.user)) + to_chat(ui.user, "Security measures prevent you from changing the alert level.") return else if(alert_level_cooldown > world.time) - to_chat(usr, "Please allow at least one minute between manual changes to the alert level.") + to_chat(ui.user, "Please allow at least one minute between manual changes to the alert level.") return alert_level_cooldown = world.time + 60 SECONDS - var/mob/living/carbon/human/H = usr + var/mob/living/carbon/human/H = ui.user var/obj/item/card/id/I = H.get_idcard(TRUE) if(istype(I)) // You must have captain access and it must be red alert or lower (no getting off delta/epsilon) if((ACCESS_CAPTAIN in I.access) && SSsecurity_level.get_current_level_as_number() <= SEC_LEVEL_RED) change_security_level(text2num(params["level"])) else - to_chat(usr, "You are not authorized to do this.") - setMenuState(usr, COMM_SCREEN_MAIN) + to_chat(ui.user, "You are not authorized to do this.") + setMenuState(ui.user, COMM_SCREEN_MAIN) else - to_chat(usr, "You need to wear your ID.") + to_chat(ui.user, "You need to wear your ID.") if("announce") - if(is_authenticated(usr) >= COMM_AUTHENTICATION_CAPT) + if(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT) if(message_cooldown > world.time) - to_chat(usr, "Please allow at least one minute to pass between announcements.") + to_chat(ui.user, "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") as null|message - if(!input || message_cooldown > world.time || ..() || !(is_authenticated(usr) >= COMM_AUTHENTICATION_CAPT)) + var/input = input(ui.user, "Please write a message to announce to the station crew.", "Priority Announcement") as null|message + if(!input || message_cooldown > world.time || ..() || !(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT)) return if(length(input) < COMM_MSGLEN_MINIMUM) - to_chat(usr, "Message '[input]' is too short. [COMM_MSGLEN_MINIMUM] character minimum.") + to_chat(ui.user, "Message '[input]' is too short. [COMM_MSGLEN_MINIMUM] character minimum.") return announcer.Announce(input) message_cooldown = world.time + 600 //One minute if("callshuttle") var/input = input("Please enter the reason for calling the shuttle.", "Shuttle Call Reason.") as null|message - if(!input || ..() || !is_authenticated(usr)) + if(!input || ..() || !is_authenticated(ui.user)) return - call_shuttle_proc(usr, input) + call_shuttle_proc(ui.user, input) if(SSshuttle.emergency.timer) post_status(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME) - setMenuState(usr, COMM_SCREEN_MAIN) + setMenuState(ui.user, COMM_SCREEN_MAIN) if("cancelshuttle") - if(isAI(usr) || isrobot(usr)) - to_chat(usr, "Firewalls prevent you from recalling the shuttle.") + if(isAI(ui.user) || isrobot(ui.user)) + to_chat(ui.user, "Firewalls prevent you from recalling the shuttle.") return var/response = alert("Are you sure you wish to recall the shuttle?", "Confirm", "Yes", "No") if(response == "Yes") - cancel_call_proc(usr) + cancel_call_proc(ui.user) if(SSshuttle.emergency.timer) post_status(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME) - setMenuState(usr, COMM_SCREEN_MAIN) + setMenuState(ui.user, COMM_SCREEN_MAIN) if("messagelist") currmsg = null aicurrmsg = null if(params["msgid"]) - setCurrentMessage(usr, text2num(params["msgid"])) - setMenuState(usr, COMM_SCREEN_MESSAGES) + setCurrentMessage(ui.user, text2num(params["msgid"])) + setMenuState(ui.user, COMM_SCREEN_MESSAGES) if("delmessage") if(params["msgid"]) currmsg = text2num(params["msgid"]) - var/response = alert("Are you sure you wish to delete this message?", "Confirm", "Yes", "No") - if(response == "Yes") - if(currmsg) - var/id = getCurrentMessage() - var/title = messagetitle[id] - var/text = messagetext[id] - messagetitle.Remove(title) - messagetext.Remove(text) - if(currmsg == id) - currmsg = null - if(aicurrmsg == id) - aicurrmsg = null - setMenuState(usr, COMM_SCREEN_MESSAGES) + if(currmsg) + var/id = getCurrentMessage() + var/title = messagetitle[id] + var/text = messagetext[id] + messagetitle.Remove(title) + messagetext.Remove(text) + if(currmsg == id) + currmsg = null + if(aicurrmsg == id) + aicurrmsg = null + setMenuState(ui.user, COMM_SCREEN_MESSAGES) if("status") - setMenuState(usr, COMM_SCREEN_STAT) + setMenuState(ui.user, COMM_SCREEN_STAT) // Status display stuff if("setstat") @@ -214,74 +231,74 @@ else display_icon = null post_status(display_type) - setMenuState(usr, COMM_SCREEN_STAT) + setMenuState(ui.user, COMM_SCREEN_STAT) if("setmsg1") stat_msg1 = clean_input("Line 1", "Enter Message Text", stat_msg1) - setMenuState(usr, COMM_SCREEN_STAT) + setMenuState(ui.user, COMM_SCREEN_STAT) if("setmsg2") stat_msg2 = clean_input("Line 2", "Enter Message Text", stat_msg2) - setMenuState(usr, COMM_SCREEN_STAT) + setMenuState(ui.user, COMM_SCREEN_STAT) if("nukerequest") - if(is_authenticated(usr) >= COMM_AUTHENTICATION_CAPT) + if(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT) if(centcomm_message_cooldown > world.time) - to_chat(usr, "Arrays recycling. Please stand by.") + to_chat(ui.user, "Arrays recycling. Please stand by.") return - var/input = stripped_input(usr, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.","") - if(!input || ..() || !(is_authenticated(usr) >= COMM_AUTHENTICATION_CAPT)) + var/input = stripped_input(ui.user, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.","") + if(!input || ..() || !(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT)) return if(length(input) < COMM_CCMSGLEN_MINIMUM) - to_chat(usr, "Message '[input]' is too short. [COMM_CCMSGLEN_MINIMUM] character minimum.") + to_chat(ui.user, "Message '[input]' is too short. [COMM_CCMSGLEN_MINIMUM] character minimum.") return - Nuke_request(input, usr) - to_chat(usr, "Request sent.") - log_game("[key_name(usr)] has requested the nuclear codes from Centcomm") - GLOB.major_announcement.Announce("The codes for the on-station nuclear self-destruct have been requested by [usr]. Confirmation or denial of this request will be sent shortly.", "Nuclear Self Destruct Codes Requested",'sound/AI/commandreport.ogg') + Nuke_request(input, ui.user) + to_chat(ui.user, "Request sent.") + log_game("[key_name(ui.user)] has requested the nuclear codes from Centcomm") + GLOB.major_announcement.Announce("The codes for the on-station nuclear self-destruct have been requested by [ui.user]. Confirmation or denial of this request will be sent shortly.", "Nuclear Self Destruct Codes Requested",'sound/AI/commandreport.ogg') centcomm_message_cooldown = world.time + 6000 // 10 minutes - setMenuState(usr, COMM_SCREEN_MAIN) + setMenuState(ui.user, COMM_SCREEN_MAIN) if("MessageCentcomm") - if(is_authenticated(usr) >= COMM_AUTHENTICATION_CAPT) + if(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT) if(centcomm_message_cooldown > world.time) - to_chat(usr, "Arrays recycling. Please stand by.") + to_chat(ui.user, "Arrays recycling. Please stand by.") return - var/input = stripped_input(usr, "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.", "To abort, send an empty message.", "") - if(!input || ..() || !(is_authenticated(usr) >= COMM_AUTHENTICATION_CAPT)) + var/input = stripped_input(ui.user, "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.", "To abort, send an empty message.", "") + if(!input || ..() || !(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT)) return if(length(input) < COMM_CCMSGLEN_MINIMUM) - to_chat(usr, "Message '[input]' is too short. [COMM_CCMSGLEN_MINIMUM] character minimum.") + to_chat(ui.user, "Message '[input]' is too short. [COMM_CCMSGLEN_MINIMUM] character minimum.") return - Centcomm_announce(input, usr) + Centcomm_announce(input, ui.user) print_centcom_report(input, station_time_timestamp() + " Captain's Message") - to_chat(usr, "Message transmitted.") - log_game("[key_name(usr)] has made a Centcomm announcement: [input]") + to_chat(ui.user, "Message transmitted.") + log_game("[key_name(ui.user)] has made a Centcomm announcement: [input]") centcomm_message_cooldown = world.time + 6000 // 10 minutes - setMenuState(usr, COMM_SCREEN_MAIN) + setMenuState(ui.user, COMM_SCREEN_MAIN) // OMG SYNDICATE ...LETTERHEAD if("MessageSyndicate") - if((is_authenticated(usr) >= COMM_AUTHENTICATION_CAPT) && (src.emagged)) + if((is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT) && (src.emagged)) if(centcomm_message_cooldown > world.time) - to_chat(usr, "Arrays recycling. Please stand by.") + to_chat(ui.user, "Arrays recycling. Please stand by.") return - var/input = stripped_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.", "To abort, send an empty message.", "") - if(!input || ..() || !(is_authenticated(usr) >= COMM_AUTHENTICATION_CAPT)) + var/input = stripped_input(ui.user, "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.", "To abort, send an empty message.", "") + if(!input || ..() || !(is_authenticated(ui.user) >= COMM_AUTHENTICATION_CAPT)) return if(length(input) < COMM_CCMSGLEN_MINIMUM) - to_chat(usr, "Message '[input]' is too short. [COMM_CCMSGLEN_MINIMUM] character minimum.") + to_chat(ui.user, "Message '[input]' is too short. [COMM_CCMSGLEN_MINIMUM] character minimum.") return - Syndicate_announce(input, usr) - to_chat(usr, "Message transmitted.") - log_game("[key_name(usr)] has made a Syndicate announcement: [input]") + Syndicate_announce(input, ui.user) + to_chat(ui.user, "Message transmitted.") + log_game("[key_name(ui.user)] has made a Syndicate announcement: [input]") centcomm_message_cooldown = world.time + 6000 // 10 minutes - setMenuState(usr, COMM_SCREEN_MAIN) + setMenuState(ui.user, COMM_SCREEN_MAIN) if("RestoreBackup") - to_chat(usr, "Backup routing data restored!") + to_chat(ui.user, "Backup routing data restored!") emagged = FALSE - setMenuState(usr, COMM_SCREEN_MAIN) + setMenuState(ui.user, COMM_SCREEN_MAIN) if("RestartNanoMob") if(SSmob_hunt) @@ -289,12 +306,94 @@ var/loading_msg = pick("Respawning spawns", "Reticulating splines", "Flipping hat", "Capturing all of them", "Fixing minor text issues", "Being the very best", "Nerfing this", "Not communicating with playerbase", "Coding a ripoff in a 2D spaceman game") - to_chat(usr, "Restarting Nano-Mob Hunter GO! game server. [loading_msg]...") + to_chat(ui.user, "Restarting Nano-Mob Hunter GO! game server. [loading_msg]...") else - to_chat(usr, "Nano-Mob Hunter GO! game server reboot failed due to recent restart. Please wait before re-attempting.") + to_chat(ui.user, "Nano-Mob Hunter GO! game server reboot failed due to recent restart. Please wait before re-attempting.") else - to_chat(usr, "Nano-Mob Hunter GO! game server is offline for extended maintenance. Contact your Central Command administrators for more info if desired.") + to_chat(ui.user, "Nano-Mob Hunter GO! game server is offline for extended maintenance. Contact your Central Command administrators for more info if desired.") + // ADMIN CENTCOMM ONLY STUFF + + if("send_to_cc_announcement_page") + if(!ADMIN_CHECK(ui.user)) + return + setMenuState(ui.user, COMM_SCREEN_ANNOUNCER) + + if("make_other_announcement") + if(!ADMIN_CHECK(ui.user)) + return + ui.user.client.cmd_admin_create_centcom_report() + + if("dispatch_ert") + if(!ADMIN_CHECK(ui.user)) + return + ui.user.client.response_team() // check_rights is handled on the other side, if someone does get ahold of this + + if("send_nuke_codes") + if(!ADMIN_CHECK(ui.user)) + return + print_nuke_codes() + + if("move_gamma_armory") + if(!ADMIN_CHECK(ui.user)) + return + SSblackbox.record_feedback("tally", "admin_comms_console", 1, "Send Gamma Armory") + log_and_message_admins("moved the gamma armory") + move_gamma_ship() + + if("test_sound") + if(!ADMIN_CHECK(ui.user)) + return + SEND_SOUND(ui.user, sound(cc_announcement_sounds[params["sound"]])) + + if("toggle_ert_allowed") + if(!ADMIN_CHECK(ui.user)) + return + ui.user.client.toggle_ert_calling() + + if("view_econ") + if(!ADMIN_CHECK(ui.user)) + return + ui.user.client.economy_manager() + + if("view_fax") + if(!ADMIN_CHECK(ui.user)) + return + ui.user.client.fax_panel() + + if("make_cc_announcement") + if(!ADMIN_CHECK(ui.user)) + return + if(!text2bool(params["classified"])) + GLOB.major_announcement.Announce( + params["text"], + new_title = "Central Command Report", + new_subtitle = params["subtitle"], + new_sound = cc_announcement_sounds[params["beepsound"]] + ) + print_command_report(params["text"], params["subtitle"]) + else + GLOB.command_announcer.autosay("A classified message has been printed out at all communication consoles.") + print_command_report(params["text"], "Classified: [params["subtitle"]]") + + log_and_message_admins("has created a communications report: [params["text"]]") + // Okay but this is just an IC way of accessing the same verb + SSblackbox.record_feedback("tally", "admin_comms_console", 1, "Create CC Report") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! + +/obj/machinery/computer/communications/proc/print_nuke_codes() + playsound(loc, 'sound/goonstation/machines/printer_dotmatrix.ogg', 50, TRUE) + var/obj/item/paper/P = new /obj/item/paper(get_turf(src)) + P.name = "'CONFIDENTIAL' - [station_name()] Nuclear Codes" + P.info = "

CONFIDENTIAL


" + + P.info += "The nuclear codes to [station_name()]'s nuclear device are [get_nuke_code()].
" + switch(get_nuke_status()) + if(NUKE_MISSING) + P.info += "Long-range scanners cannot detect the nuclear device on-station." + if(NUKE_CORE_MISSING) + P.info += "Long-range scanners detect no radioactive signatures from inside the device." + + P.info += "

Failure to comply with company regulatory confidential guidelines may result in immediate termination, at the jurisdiction of Central Command staff." /obj/machinery/computer/communications/emag_act(user as mob) @@ -334,6 +433,10 @@ data["authenticated"] = is_authenticated(user, 0) data["authhead"] = data["authenticated"] >= COMM_AUTHENTICATION_HEAD && (data["authenticated"] == COMM_AUTHENTICATION_AGHOST || !isobserver(user)) data["authcapt"] = data["authenticated"] >= COMM_AUTHENTICATION_CAPT && (data["authenticated"] == COMM_AUTHENTICATION_AGHOST || !isobserver(user)) + data["is_admin"] = data["authenticated"] >= COMM_AUTHENTICATION_CENTCOM && (data["authenticated"] == COMM_AUTHENTICATION_AGHOST || !isobserver(user)) + + data["gamma_armory_location"] = GLOB.gamma_ship_location + data["ert_allowed"] = !SSticker.mode.ert_disabled data["stat_display"] = list( "type" = display_type, @@ -366,10 +469,6 @@ else data["security_level_color"] = "purple"; data["str_security_level"] = capitalize(SSsecurity_level.get_current_level_as_text()) - data["levels"] = list( - list("id" = SEC_LEVEL_GREEN, "name" = "Green", "icon" = "dove"), - list("id" = SEC_LEVEL_BLUE, "name" = "Blue", "icon" = "eye"), - ) var/list/msg_data = list() for(var/i = 1; i <= messagetext.len; i++) @@ -400,6 +499,29 @@ data["esc_section"] = data["esc_status"] || data["esc_callable"] || data["esc_recallable"] || data["lastCallLoc"] return data +/obj/machinery/computer/communications/ui_static_data(mob/user) + var/list/data = list() + + data["levels"] = list( + list("id" = SEC_LEVEL_GREEN, "name" = "Green", "icon" = "dove"), + list("id" = SEC_LEVEL_BLUE, "name" = "Blue", "icon" = "eye"), + ) + + data["admin_levels"] = list( + list("id" = SEC_LEVEL_RED, "name" = "Red", "icon" = "exclamation"), + list("id" = SEC_LEVEL_GAMMA, "name" = "Gamma", "icon" = "biohazard"), + list("id" = SEC_LEVEL_EPSILON, "name" = "Epsilon", "icon" = "skull", "tooltip" = "Epsilon Alert will only activate after 15 or so seconds."), + list("id" = SEC_LEVEL_DELTA, "name" = "Delta", "icon" = "bomb"), + ) + + var/list/keys = list() + for(var/sound_name in cc_announcement_sounds) + keys += sound_name + + data["possible_cc_sounds"] = keys + + return data + /obj/machinery/computer/communications/proc/setCurrentMessage(mob/user, value) if(isAI(user) || isrobot(user)) aicurrmsg = value @@ -521,4 +643,4 @@ C.messagetitle.Add("[title]") C.messagetext.Add(text) - +#undef ADMIN_CHECK diff --git a/code/modules/admin/holder2.dm b/code/modules/admin/holder2.dm index 8cbd56311dc..9c0091e1aba 100644 --- a/code/modules/admin/holder2.dm +++ b/code/modules/admin/holder2.dm @@ -145,6 +145,29 @@ you will have to do something like if(client.holder.rights & R_ADMIN) yourself. return 1 return 0 +/** + * Requires the holder to have all the rights specified + * + * rights_required = R_ADMIN|R_EVENT means they must have both flags, or it will return false + */ +/proc/check_rights_all(rights_required, show_msg = TRUE, mob/user = usr) + if(!user?.client) + return FALSE + if(!rights_required) + if(user.client.holder) + return TRUE + if(show_msg) + to_chat(user, "Error: You are not an admin.") + return FALSE + + if(!user.client.holder) + return FALSE + if((user.client.holder.rights & rights_required) == rights_required) + return TRUE + if(show_msg) + to_chat(user, "Error: You do not have sufficient rights to do that. You require all of the following flags:[rights2text(rights_required, " ")].") + return FALSE + /datum/admins/vv_edit_var(var_name, var_value) return FALSE // no admin abuse diff --git a/code/modules/admin/verbs/pray.dm b/code/modules/admin/verbs/pray.dm index 2479ce2e73f..d1973f34c16 100644 --- a/code/modules/admin/verbs/pray.dm +++ b/code/modules/admin/verbs/pray.dm @@ -1,7 +1,3 @@ -#define NUKE_INTACT 0 -#define NUKE_CORE_MISSING 1 -#define NUKE_MISSING 2 - /mob/living/verb/pray(msg as text) set category = "IC" set name = "Pray" @@ -97,6 +93,3 @@ if(X.prefs.sound & SOUND_ADMINHELP) SEND_SOUND(X, sound('sound/effects/adminhelp.ogg')) -#undef NUKE_INTACT -#undef NUKE_CORE_MISSING -#undef NUKE_MISSING diff --git a/tgui/packages/tgui/interfaces/CommunicationsComputer.js b/tgui/packages/tgui/interfaces/CommunicationsComputer.js index ff06b32b146..92e8bede28d 100644 --- a/tgui/packages/tgui/interfaces/CommunicationsComputer.js +++ b/tgui/packages/tgui/interfaces/CommunicationsComputer.js @@ -1,42 +1,93 @@ import { Fragment } from 'inferno'; -import { useBackend } from '../backend'; -import { Button, LabeledList, Box, Section } from '../components'; +import { useBackend, useLocalState } from '../backend'; +import { + Button, + LabeledList, + Box, + Section, + Collapsible, + Input, + Flex, + Dropdown, +} from '../components'; import { Window } from '../layouts'; +const PickWindow = (index) => { + switch (index) { + case 1: + return ; + case 2: + return ; + case 3: + return ; + case 4: + return ; + default: + return 'ERROR. Unknown menu_state. Please contact NT Technical Support.'; + } +}; + export const CommunicationsComputer = (props, context) => { const { act, data } = useBackend(context); + const { menu_state } = data; + + return ( + + + + {PickWindow(menu_state)} + + + ); +}; + +const AuthBlock = (props, context) => { + const { act, data } = useBackend(context); + + const { + authenticated, + noauthbutton, + esc_section, + esc_callable, + esc_recallable, + esc_status, + authhead, + is_ai, + lastCallLoc, + } = data; + + let hideLogButton = false; let authReadable; - let authSpecial = false; - if (!data.authenticated) { + if (!authenticated) { authReadable = 'Not Logged In'; - } else if (data.authenticated === 1) { + } else if (authenticated === 1) { authReadable = 'Command'; - } else if (data.authenticated === 2) { + } else if (authenticated === 2) { authReadable = 'Captain'; - } else if (data.authenticated === 3) { + } else if (authenticated === 3) { + authReadable = 'CentComm Officer'; + } else if (authenticated === 4) { authReadable = 'CentComm Secure Connection'; - authSpecial = true; + hideLogButton = true; } else { authReadable = 'ERROR: Report This Bug!'; } - let reportText = 'View (' + data.messages.length + ')'; - let authBlock = ( + + return (
- {(authSpecial && ( + {(hideLogButton && ( {authReadable} )) || (
- {!!data.esc_section && ( + {!!esc_section && (
- {!!data.esc_status && ( - - {data.esc_status} - + {!!esc_status && ( + {esc_status} )} - {!!data.esc_callable && ( + {!!esc_callable && (
+ + + +
+ ); +}; + +const PlayerPage = (props, context) => { + const { act, data } = useBackend(context); + + const { + msg_cooldown, + emagged, + cc_cooldown, + security_level_color, + str_security_level, + levels, + authcapt, + authhead, + messages, + } = data; + let announceText = 'Make Priority Announcement'; - if (data.msg_cooldown > 0) { - announceText += ' (' + data.msg_cooldown + 's)'; + if (msg_cooldown > 0) { + announceText += ' (' + msg_cooldown + 's)'; } - let ccMessageText = data.emagged ? 'Message [UNKNOWN]' : 'Message CentComm'; + + let ccMessageText = emagged ? 'Message [UNKNOWN]' : 'Message CentComm'; let nukeRequestText = 'Request Authentication Codes'; - if (data.cc_cooldown > 0) { - ccMessageText += ' (' + data.cc_cooldown + 's)'; - nukeRequestText += ' (' + data.cc_cooldown + 's)'; + if (cc_cooldown > 0) { + ccMessageText += ' (' + cc_cooldown + 's)'; + nukeRequestText += ' (' + cc_cooldown + 's)'; } - let alertLevelText = data.str_security_level; - let alertLevelButtons = data.levels.map((slevel) => { - return ( -