From 338186c55d9184dbe0539cc4c8a115247583f42f Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:17:10 +0200 Subject: [PATCH] [MIRROR] Admin narrations now let you pick a text formatting span to use in your message (#28709) * Admin narrations now let you pick a text formatting span to use in your message (#84723) ## About The Pull Request This adds a menu to all admin narrate verbs that allows you to select a span type for your message. This includes global, direct, world, subtle, and headset narrates. This includes (nearly) all forms of text span. Some were not included, like OOC announcements, centcom priority announcement headers, the span used for hyperlink text, stuff like that. They're mostly all there, but the stuff that probably shouldn't be showing up under a generic chat message has been excluded. There's well over 100 of these things, so pick whatever you want. Due to the way this works, you can close the spans in the message mid-string, in case you wanted to have multiple text formats in the message. You can also just format text the old-fashioned way if you really wanted. ![image](https://github.com/tgstation/tgstation/assets/28870487/3ef57ba8-972f-4cf6-95af-d0cfd6d7c169) **_Fun fact -- When using admin OOC spans, the reply will copy whatever your admin OOC color is._** ![image](https://github.com/tgstation/tgstation/assets/28870487/e9b5f7c0-5a07-49e8-bcc3-57e7adf6cf52) Yeah I'm sure you can tell I'm a super mature person by what the test messages I used here were. Laugh it up. Just know that I'm laughing too, like a grade schooler who just learned their first swear words. ## Why It's Good For The Game No more futzing about with copypastes and big long text files with the span formatting already written out. Now, you can just pick them from a list. Neato! This will increase adminbus immersion by a factor of at least 3-5% assuming all projections and the data we have been provided holds true. ## Changelog :cl: Rhials admin: Narrate verbs will now allow you to pick what text formatting span you want to use before you send them, if any. /:cl: * Admin narrations now let you pick a text formatting span to use in your message --------- Co-authored-by: Rhials <28870487+Rhials@users.noreply.github.com> --- code/_globalvars/admin.dm | 120 ++++++++++++++++++++++++ code/modules/admin/verbs/adminevents.dm | 19 ++++ 2 files changed, 139 insertions(+) diff --git a/code/_globalvars/admin.dm b/code/_globalvars/admin.dm index 363b84b923d..96f07e3cca8 100644 --- a/code/_globalvars/admin.dm +++ b/code/_globalvars/admin.dm @@ -28,3 +28,123 @@ GLOBAL_LIST_INIT(vv_special_lists, init_special_list_names()) if(isnull(locate(REF(value)))) output += varname return output + +///A giant associative list of span names, and the associated key to create the text span. Used for narrate verbs. +GLOBAL_LIST_INIT(spanname_to_formatting, list( + "Abductor" = "abductor", + "Admin" = "admin", + "Adminhelp" = "adminhelp", + "Admin Notice" = "adminnotice", + "Admin Observer OOC" = "adminobserverooc", + "Admin OOC" = "adminooc", + "Adminsay" = "adminsay", + "AI Private Radio" = "aiprivradio", + "Alert" = "alert", + "Alien Alert" = "alertalien", + "Syndie Alert" = "alertsyndie", + "Alert Warning" = "alertwarning", + "Alien" = "alien", + "Average" = "average", + "Bad" = "bad", + "Big" = "big", + "Binary Say" = "binarysay", + "Blob" = "blob", + "Blob Announce" = "blobannounce", + "Blue" = "blue", + "Blue Team Radio" = "blueteamradio", + "Bold" = "bold", + "Bold Announce" = "boldannounce", + "Bold Danger" = "bolddanger", + "Bold Italic" = "bolditalic", + "Bold Nice Green" = "boldnicegreen", + "Bold Notice" = "boldnotice", + "Bold Warning" = "boldwarning", + "Big Bold" = "big bold", + "Centcom Radio" = "centcomradio", + "Changeling" = "changeling", + "Clown" = "clown", + "Colossus" = "colossus", + "Command Headset" = "command_headset", + "Cult" = "cult", + "Cult Bold" = "cult_bold", + "Cult Bold Italic" = "cult_bold_italic", + "Cult Italic" = "cult_italic", + "Cult Large" = "cult_large", + "Danger" = "danger", + "Deadchat" = "deadsay", + "Deconversion Message" = "deconversion_message", + "Drone Radio" = "drone", + "Engineering Radio" = "engradio", + "Extremely Big" = "extremelybig", + "Game Say" = "game say", + "Ghost Alert" = "ghostalert", + "Green" = "green", + "Green Announce" = "greenannounce", + "Green Team Radio" = "greenteamradio", + "Greentext" = "greentext", + "Grey" = "grey", + "Hierophant" = "hierophant", + "Hierophant Warning" = "hierophant_warning", + "Highlight" = "highlight", + "His Grace" = "his_grace", + "Holoparasite" = "holoparasite", + "Holoparasite Bold" = "holoparasite bold", + "Hypnosis" = "hypnophrase", + "Icon" = "icon", + "Info" = "info", + "Info Plain" = "infoplain", + "Interface" = "interface", + "Looc" = "looc", + "Medal" = "medal", + "Medradio" = "medradio", + "Message" = "message", + "Mind Control" = "mind_control", + "Monkey" = "monkey", + "Narsie" = "narsie", + "Narsie Small" = "narsiesmall", + "Nice Green" = "nicegreen", + "Notice" = "notice", + "Notice Alien" = "noticealien", + "OOC" = "ooc", + "Papyrus" = "papyrus", + "Phobia" = "phobia", + "Prefix" = "prefix", + "Purple" = "purple", + "Radio" = "radio", + "Really Big" = "reallybig", + "Red" = "red", + "Red Team Radio" = "redteamradio", + "Red Text" = "redtext", + "Golem Resonate" = "resonate", + "Revenant Big Notice" = "revenbignotice", + "Revenant Bold Notice" = "revenboldnotice", + "Revenant Danger" = "revendanger", + "Revenant Minor" = "revenminor", + "Revenant Notice" = "revennotice", + "Revenant Warning" = "revenwarning", + "Robot" = "robot", + "Rose" = "rose", + "Comic Sans" = "sans", + "Science Radio" = "sciradio", + "Security Radio" = "secradio", + "Service Radio" = "servradio", + "Singing" = "singing", + "Slime" = "slime", + "Small" = "small", + "Small Notice" = "smallnotice", + "Small Notice Italic" = "smallnoticeital", + "Spider Broodmother" = "spiderbroodmother", + "Spider Scout" = "spiderscout", + "Spider Breacher" = "spiderbreacher", + "Suicide" = "suicide", + "Supply Radio" = "suppradio", + "Syndicate Radio" = "syndradio", + "Tape Recorder" = "tape_recorder", + "Tiny Notice" = "tinynotice", + "Tiny Notice Italic" = "tinynoticeital", + "Unconcious" = "unconscious", + "User Danger" = "userdanger", + "Warning" = "warning", + "Yelling" = "yell", + "Yellow Team Radio" = "yellowteamradio", + )) diff --git a/code/modules/admin/verbs/adminevents.dm b/code/modules/admin/verbs/adminevents.dm index d6120962fd1..a9d285815ad 100644 --- a/code/modules/admin/verbs/adminevents.dm +++ b/code/modules/admin/verbs/adminevents.dm @@ -8,6 +8,8 @@ ADMIN_VERB_AND_CONTEXT_MENU(cmd_admin_subtle_message, R_ADMIN, "Subtle Message", message_admins("[key_name_admin(user)] decided not to answer [ADMIN_LOOKUPFLW(target)]'s prayer") return + msg = user.reformat_narration(msg) + target.balloon_alert(target, "you hear a voice") to_chat(target, "You hear a voice in your head... [msg]", confidential = TRUE) @@ -53,6 +55,8 @@ ADMIN_VERB_AND_CONTEXT_MENU(cmd_admin_headset_message, R_ADMIN, "Headset Message message_admins("[key_name_admin(src)] decided not to answer [key_name_admin(target)]'s [sender] request.") return + input = reformat_narration(input) + log_directed_talk(mob, target, input, LOG_ADMIN, "reply") message_admins("[key_name_admin(src)] replied to [key_name_admin(target)]'s [sender] message with: \"[input]\"") target.balloon_alert(target, "you hear a voice") @@ -64,6 +68,7 @@ ADMIN_VERB(cmd_admin_world_narrate, R_ADMIN, "Global Narrate", "Send a direct na var/msg = input(user, "Message:", "Enter the text you wish to appear to everyone:") as text|null if (!msg) return + msg = user.reformat_narration(msg) to_chat(world, "[msg]", confidential = TRUE) log_admin("GlobalNarrate: [key_name(user)] : [msg]") message_admins(span_adminnotice("[key_name_admin(user)] Sent a global narrate")) @@ -76,6 +81,7 @@ ADMIN_VERB_AND_CONTEXT_MENU(cmd_admin_local_narrate, R_ADMIN, "Local Narrate", A var/msg = input(user, "Message:", "Enter the text you wish to appear to everyone within view:") as text|null if (!msg) return + msg = user.reformat_narration(msg) for(var/mob/M in view(range, locale)) to_chat(M, msg, confidential = TRUE) @@ -89,6 +95,8 @@ ADMIN_VERB_AND_CONTEXT_MENU(cmd_admin_direct_narrate, R_ADMIN, "Direct Narrate", if( !msg ) return + msg = user.reformat_narration(msg) + to_chat(target, msg, confidential = TRUE) log_admin("DirectNarrate: [key_name(user)] to ([key_name(target)]): [msg]") msg = span_adminnotice(" DirectNarrate: [key_name_admin(user)] to ([key_name_admin(target)]): [msg]
") @@ -278,3 +286,14 @@ ADMIN_VERB(command_report_footnote, R_ADMIN, "Command Report Footnote", "Adds a ADMIN_VERB(delay_command_report, R_FUN, "Delay Command Report", "Prevents the roundstart command report from being sent; or forces it to send it delayed.", ADMIN_CATEGORY_EVENTS) GLOB.communications_controller.block_command_report = !GLOB.communications_controller.block_command_report message_admins("[key_name_admin(user)] has [(GLOB.communications_controller.block_command_report ? "delayed" : "sent")] the roundstart command report.") + +///Reformats a narration message. First provides a prompt asking if the user wants to reformat their message, then allows them to pick from a list of spans to use. +/client/proc/reformat_narration(input) + if(tgui_alert(mob, "Set a custom text format?", "Make it snazzy!", list("Yes", "No")) == "Yes") + var/text_span = tgui_input_list(mob, "Select a span!", "Immersion! Yeah!", GLOB.spanname_to_formatting) + if(isnull(text_span)) //In case the user just quit the prompt. + return text_span + text_span = GLOB.spanname_to_formatting[text_span] + input = "" + input + "" + + return input