From d7f49bae5ba3efc78256c5fd8d48c69a3c29bd45 Mon Sep 17 00:00:00 2001 From: silencer-pl <103842328+silencer-pl@users.noreply.github.com> Date: Wed, 28 Aug 2024 15:39:33 -0400 Subject: [PATCH 1/2] initial --- code/__DEFINES/chat.dm | 3 + code/_onclick/hud/fullscreen.dm | 1 + code/modules/admin/admin_verbs.dm | 3 + code/modules/admin/tabs/event_tab.dm | 88 ++++++++++++++++++- .../tgui-panel/audio/NowPlayingWidget.jsx | 8 +- .../tgui-panel/styles/goon/chat-dark.scss | 14 +++ .../tgui-panel/styles/goon/chat-light.scss | 14 +++ 7 files changed, 124 insertions(+), 7 deletions(-) diff --git a/code/__DEFINES/chat.dm b/code/__DEFINES/chat.dm index 85966e4032..b481d99468 100644 --- a/code/__DEFINES/chat.dm +++ b/code/__DEFINES/chat.dm @@ -23,3 +23,6 @@ /// Adds a generic box around whatever message you're sending in chat. Really makes things stand out. #define examine_block(str) ("
" + str + "
") + +#define narrate_head(str) ("

" + str + "

") +#define narrate_body(str) ("

" + str + "

") diff --git a/code/_onclick/hud/fullscreen.dm b/code/_onclick/hud/fullscreen.dm index b0e2d2b57e..ca71a97113 100644 --- a/code/_onclick/hud/fullscreen.dm +++ b/code/_onclick/hud/fullscreen.dm @@ -2,6 +2,7 @@ /mob var/list/fullscreens = list() + var/list/narration_settings = list("Name" = null, "Location" = null, "Position" = null) /mob/proc/overlay_fullscreen(category, type, severity) var/atom/movable/screen/fullscreen/screen = fullscreens[category] diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 4d1f4ba083..a8f6a7e988 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -141,6 +141,9 @@ var/list/admin_verbs_minor_event = list( /client/proc/admin_biohazard_alert, /client/proc/toggle_hardcore_perma, /client/proc/toggle_bypass_joe_restriction, + /client/proc/set_narration_preset, + /client/proc/speak_to_comms, + /client/proc/call_tgui_play_directly, ) var/list/admin_verbs_major_event = list( diff --git a/code/modules/admin/tabs/event_tab.dm b/code/modules/admin/tabs/event_tab.dm index a46ff34e3e..24b448d3ef 100644 --- a/code/modules/admin/tabs/event_tab.dm +++ b/code/modules/admin/tabs/event_tab.dm @@ -652,13 +652,30 @@ to_chat(src, "Only administrators may use this command.") return - var/msg = input("Message:", text("Enter the text you wish to appear to everyone:")) as text + var/narrate_body_text + var/narrate_header_text + var/narrate_output - if(!msg) + if(tgui_alert(src, "Do you want your narration to include a header paragraph?", "Global Narrate", list("Yes", "No"), timeout = 0) == "Yes") + narrate_header_text = tgui_input_text(src, "Please type the header paragraph below. One or two sentences or a title work best. HTML style tags are available. Paragraphs are not recommended.", "Global Narrate Header", max_length = MAX_BOOK_MESSAGE_LEN, multiline = TRUE, encode = FALSE, timeout = 0) + if(!narrate_header_text) + return + narrate_body_text = tgui_input_text(src, "Please enter the text for your narration. Paragraphs without line breaks produce the best visual results, but HTML tags in general are respected.", "Global Narrate Text", max_length = MAX_BOOK_MESSAGE_LEN, multiline = TRUE, encode = FALSE, timeout = 0) + if(!narrate_body_text) return - to_chat_spaced(world, html = SPAN_ANNOUNCEMENT_HEADER_BLUE(msg)) - message_admins("\bold GlobalNarrate: [key_name_admin(usr)] : [msg]") + if(!narrate_header_text) + narrate_output = "[narrate_body("[narrate_body_text]")]" + else + narrate_output = "[narrate_head("[narrate_header_text]")]" + "[narrate_body("[narrate_body_text]")]" + + to_chat(world, "[narrate_output]") + while(narrate_body_text != null) + narrate_body_text = tgui_input_text(src, "Please enter the text for your narration. Paragraphs without line breaks produce the best visual results, but HTML tags in general are respected.", "Global Narrate Text", max_length = MAX_BOOK_MESSAGE_LEN, multiline = TRUE, encode = FALSE, timeout = 0) + if(!narrate_body_text) + return + to_chat(world, narrate_body("[narrate_body_text]")) + /client/proc/cmd_admin_ground_narrate() set name = "Narrate to Ground Levels" @@ -1055,3 +1072,66 @@ return FALSE show_blurb(GLOB.player_list, duration, message, TRUE, "center", "center", "#bd2020", "ADMIN") message_admins("[key_name(usr)] sent an admin blurb alert to all players. Alert reads: '[message]' and lasts [(duration / 10)] seconds.") + +/client/proc/set_narration_preset() + set name = "Speak as NPC over comms - setup NPC" + set category = "DM.Narration" + if(!check_rights(R_ADMIN)) return + + var/list/comms_presets = list("Mission Control","Custom") + switch(tgui_input_list(usr,"Select a Comms Preset","PRESET",comms_presets,timeout = 0)) + if(null) + return + if("Mission Control") + usr.narration_settings["Name"] = "Mission Control" + usr.narration_settings["Location"] = "Arrowhead Command" + usr.narration_settings["Position"] = "SO" + if("Custom") + usr.narration_settings["Name"] = tgui_input_text(usr, "Enter the name, complete with a rank prefix.", "NAME entry", usr.narration_settings["Name"], timeout = 0) + usr.narration_settings["Location"] = tgui_input_text(usr, "Enter assignment or location, when in doubt, OV-PST works.", "LOCATION entry", usr.narration_settings["Location"], timeout = 0) + usr.narration_settings["Position"] = tgui_input_text(usr, "Enter held position like CE, CO, RFN or whatnot. Prefaced with some specialty acronym also can work.", "POSITION entry", usr.narration_settings["Position"], timeout = 0) + return + +/client/proc/speak_to_comms() + set name = "Speak as NPC over comms" + set category = "DM.Narration" + if(!check_rights(R_ADMIN)) return + + if(usr.narration_settings["Name"] == null || usr.narration_settings["Location"] == null || usr.narration_settings["Position"] == null) set_narration_preset() + var/text_to_comm = tgui_input_text(usr, "Enter what to say as [usr.narration_settings["Name"]],[usr.narration_settings["Location"]],[usr.narration_settings["Position"]] or cancel to exit.") + + while(text_to_comm != null) + to_chat(world, "[usr.narration_settings["Name"]][icon2html('icons/obj/items/radio.dmi', usr, "beacon")] \u005B[usr.narration_settings["Location"]] \u0028[usr.narration_settings["Position"]]\u0029\u005D , says \"[text_to_comm]\"", type = MESSAGE_TYPE_RADIO) + text_to_comm = tgui_input_text(usr, "Enter what to say as [usr.narration_settings["Name"]],[usr.narration_settings["Location"]],[usr.narration_settings["Position"]] or cancel to exit.") + return + +/proc/show_blurb_song(title = "Song Name",additional = "Song Artist - Song Album",)//Shows song blurb, a two line blurb. The first line passes + var/message_to_display = "[title]\n[additional]" + show_blurb(GLOB.player_list, 10 SECONDS, "[message_to_display]", screen_position = "LEFT+0:16,BOTTOM+1:16", text_alignment = "left", text_color = "#FFFFFF", blurb_key = "song[title]", ignore_key = TRUE, speed = 1) + +/client/proc/call_tgui_play_directly() + set category = "Admin.Fun" + set name = "Play Music From Direct Link" + set desc = "Plays a music file from a https:// link through tguis music player, bypassing the filtering done by the other admin command. This will play as an admin atmospheric and will be muted by clinets who have that setting turned on as expected. A blurb displaying song info can also be displayed as an extra option." + + if(!check_rights(R_ADMIN)) + return + + var/targets = GLOB.mob_list + var/list/music_extra_data = list() + var/web_sound_url = tgui_input_text(usr, "Enter link to sound file. Must use https://","LINK to play", timeout = 0) + music_extra_data["title"] = tgui_input_text(usr, "Enter song Title, leaving this blank/null will use its url instead.","Title input", timeout = 0) + music_extra_data["artist"] = tgui_input_text(usr, "Enter song Artist, or leave blank to not display.", "Artist input", timeout = 0) + music_extra_data["album"] = tgui_input_text(usr, "Enter song Album, or leave blank to not display.","Album input", timeout = 0) + if(music_extra_data["title"] == null) music_extra_data["title"] = web_sound_url + if(music_extra_data["artist"] == null) music_extra_data["artist"] = "Unknown Artist" + if(music_extra_data["album"] == null) music_extra_data["album"] = "Unknown Album" + music_extra_data["link"] = "Song Link Hidden" + music_extra_data["duration"] = "None" + for(var/mob/mob as anything in targets) + var/client/client = mob?.client + if((client?.prefs?.toggles_sound & SOUND_MIDI) && (client?.prefs?.toggles_sound & SOUND_ADMIN_ATMOSPHERIC)) + if(tgui_alert(usr, "Show title blurb?", "Blurb", list("No","Yes"), timeout = 0) == "Yes") show_blurb_song(title = music_extra_data["title"], additional = "[music_extra_data["artist"]] - [music_extra_data["album"]]") + client?.tgui_panel?.play_music(web_sound_url, music_extra_data) + else + client?.tgui_panel?.stop_music() diff --git a/tgui/packages/tgui-panel/audio/NowPlayingWidget.jsx b/tgui/packages/tgui-panel/audio/NowPlayingWidget.jsx index f101d7da03..d4c1765799 100644 --- a/tgui/packages/tgui-panel/audio/NowPlayingWidget.jsx +++ b/tgui/packages/tgui-panel/audio/NowPlayingWidget.jsx @@ -49,9 +49,11 @@ export const NowPlayingWidget = (props) => { URL: {URL} )} - - Duration: {duration} - + {duration !== '0' && duration !== 'None' && ( + + Duration: {duration} + + )} {Artist !== 'Song Artist Hidden' && Artist !== 'Unknown Artist' && ( diff --git a/tgui/packages/tgui-panel/styles/goon/chat-dark.scss b/tgui/packages/tgui-panel/styles/goon/chat-dark.scss index 7911f7aec5..d78c27f2b3 100644 --- a/tgui/packages/tgui-panel/styles/goon/chat-dark.scss +++ b/tgui/packages/tgui-panel/styles/goon/chat-dark.scss @@ -1469,3 +1469,17 @@ em { font-style: italic; border-bottom: 1px dashed #fff; } + +.narrate_head { + font-size: 125%; + color: #ffccff; + text-align: center; + padding: 0em 1em; +} + +.narrate_body { + font-size: 100%; + color: #ff99ff; + text-align: justify; + padding: 0em 1em; +} diff --git a/tgui/packages/tgui-panel/styles/goon/chat-light.scss b/tgui/packages/tgui-panel/styles/goon/chat-light.scss index 48fd3af7f2..783a6ece5b 100644 --- a/tgui/packages/tgui-panel/styles/goon/chat-light.scss +++ b/tgui/packages/tgui-panel/styles/goon/chat-light.scss @@ -1487,3 +1487,17 @@ h2.alert { font-style: italic; border-bottom: 1px dashed #000; } + +.narrate_head { + font-size: 125%; + color: #3d103d; + text-align: center; + padding: 0em 1em; +} + +.narrate_body { + font-size: 100%; + color: #020002; + text-align: justify; + padding: 0em 1em; +} From d1b2ed1b2ece520c9f91b535b4b60ede86470cc2 Mon Sep 17 00:00:00 2001 From: silencer-pl <103842328+silencer-pl@users.noreply.github.com> Date: Wed, 11 Sep 2024 08:59:22 -0400 Subject: [PATCH 2/2] fixes song blurbs --- code/modules/admin/tabs/event_tab.dm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/modules/admin/tabs/event_tab.dm b/code/modules/admin/tabs/event_tab.dm index 24b448d3ef..2374ebab72 100644 --- a/code/modules/admin/tabs/event_tab.dm +++ b/code/modules/admin/tabs/event_tab.dm @@ -1120,6 +1120,7 @@ var/targets = GLOB.mob_list var/list/music_extra_data = list() var/web_sound_url = tgui_input_text(usr, "Enter link to sound file. Must use https://","LINK to play", timeout = 0) + var/song_blurb_indicator = tgui_alert(usr, "Show title blurb?", "Blurb", list("No","Yes"), timeout = 0) music_extra_data["title"] = tgui_input_text(usr, "Enter song Title, leaving this blank/null will use its url instead.","Title input", timeout = 0) music_extra_data["artist"] = tgui_input_text(usr, "Enter song Artist, or leave blank to not display.", "Artist input", timeout = 0) music_extra_data["album"] = tgui_input_text(usr, "Enter song Album, or leave blank to not display.","Album input", timeout = 0) @@ -1131,7 +1132,7 @@ for(var/mob/mob as anything in targets) var/client/client = mob?.client if((client?.prefs?.toggles_sound & SOUND_MIDI) && (client?.prefs?.toggles_sound & SOUND_ADMIN_ATMOSPHERIC)) - if(tgui_alert(usr, "Show title blurb?", "Blurb", list("No","Yes"), timeout = 0) == "Yes") show_blurb_song(title = music_extra_data["title"], additional = "[music_extra_data["artist"]] - [music_extra_data["album"]]") + if(song_blurb_indicator == "Yes") show_blurb_song(title = music_extra_data["title"], additional = "[music_extra_data["artist"]] - [music_extra_data["album"]]") client?.tgui_panel?.play_music(web_sound_url, music_extra_data) else client?.tgui_panel?.stop_music()