From ac4f25e56344d75f8387f5f3055cb3a6012bd48d Mon Sep 17 00:00:00 2001 From: AnturK Date: Sun, 19 Jan 2020 01:04:23 +0100 Subject: [PATCH] Cross server comms update. (#48850) * Makes cross server config easier to manage and lets you send messages to specific stations. * No need for fancy copy --- .../game/machinery/computer/communications.dm | 21 ++++++++++++++----- code/modules/admin/verbs/adminhelp.dm | 11 ++++++++-- code/modules/mob/dead/dead.dm | 3 ++- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 32423e67ee4..5912e8e7e74 100755 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -127,15 +127,20 @@ if("crossserver") if(authenticated==2) + var/dest = href_list["cross_dest"] if(!checkCCcooldown()) to_chat(usr, "Arrays recycling. Please stand by.") playsound(src, 'sound/machines/terminal_prompt_deny.ogg', 50, FALSE) return - var/input = stripped_multiline_input(usr, "Please choose a message to transmit to allied stations. Please be aware that this process is very expensive, and abuse will lead to... termination.", "Send a message to an allied station.", "") + var/warning = dest == "all" ? "Please choose a message to transmit to allied stations." : "Please choose a message to transmit to [dest] sector station." + var/input = stripped_multiline_input(usr, "[warning] Please be aware that this process is very expensive, and abuse will lead to... termination.", "Send a message to an allied station.", "") if(!input || !(usr in view(1,src)) || !checkCCcooldown()) return playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 50, FALSE) - send2otherserver("[station_name()]", input,"Comms_Console") + if(dest == "all") + send2otherserver("[station_name()]", input,"Comms_Console") + else + send2otherserver("[station_name()]", input,"Comms_Console", list(dest)) minor_announce(input, title = "Outgoing message to allied station") usr.log_talk(input, LOG_SAY, tag="message to the other server") message_admins("[ADMIN_LOOKUPFLW(usr)] has sent a message to the other server.") @@ -470,9 +475,15 @@ if (authenticated==2) dat += "

Captain Functions" dat += "
\[ Make a Captain's Announcement \]" - var/cross_servers_count = length(CONFIG_GET(keyed_list/cross_server)) - if(cross_servers_count) - dat += "
\[ Send a message to [cross_servers_count == 1 ? "an " : ""]allied station[cross_servers_count > 1 ? "s" : ""] \]" + var/list/cross_servers = CONFIG_GET(keyed_list/cross_server) + var/our_id = CONFIG_GET(string/cross_comms_name) + if(cross_servers.len) + for(var/server in cross_servers) + if(server == our_id) + continue + dat += "
\[ Send a message to station in [server] sector. \]" + if(cross_servers.len > 2) + dat += "
\[ Send a message to all allied stations \]" if(SSmapping.config.allow_custom_shuttles) dat += "
\[ Purchase Shuttle \]" dat += "
\[ Change Alert Level \]" diff --git a/code/modules/admin/verbs/adminhelp.dm b/code/modules/admin/verbs/adminhelp.dm index 1bfdcc07ba0..f3bc2a38739 100644 --- a/code/modules/admin/verbs/adminhelp.dm +++ b/code/modules/admin/verbs/adminhelp.dm @@ -584,19 +584,26 @@ GLOBAL_DATUM_INIT(ahelp_tickets, /datum/admin_help_tickets, new) msg2 = replacetext(replacetext(msg2, "\proper", ""), "\improper", "") world.TgsTargetedChatBroadcast("[msg] | [msg2]", TRUE) -/proc/send2otherserver(source,msg,type = "Ahelp") +// +/proc/send2otherserver(source,msg,type = "Ahelp",target_servers) var/comms_key = CONFIG_GET(string/comms_key) if(!comms_key) return + + var/our_id = CONFIG_GET(string/cross_comms_name) var/list/message = list() message["message_sender"] = source message["message"] = msg - message["source"] = "([CONFIG_GET(string/cross_comms_name)])" + message["source"] = "([our_id])" message["key"] = comms_key message += type var/list/servers = CONFIG_GET(keyed_list/cross_server) for(var/I in servers) + if(I == our_id) //No sending to ourselves + continue + if(target_servers && !(I in target_servers)) + continue world.Export("[servers[I]]?[list2params(message)]") diff --git a/code/modules/mob/dead/dead.dm b/code/modules/mob/dead/dead.dm index 7ab4ff1fe3e..61366a12d77 100644 --- a/code/modules/mob/dead/dead.dm +++ b/code/modules/mob/dead/dead.dm @@ -70,7 +70,8 @@ INITIALIZE_IMMEDIATE(/mob/dead) set desc= "Jump to the other server" if(notransform) return - var/list/csa = CONFIG_GET(keyed_list/cross_server) + var/list/our_id = CONFIG_GET(string/cross_comms_name) + var/list/csa = CONFIG_GET(keyed_list/cross_server) - our_id var/pick switch(csa.len) if(0)