From 217f0c81e2a3b3673328e2761b8a3041cb737838 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Thu, 6 Jul 2023 08:19:47 +0200 Subject: [PATCH] [MIRROR] Request Internet Sound Optional Credit User [MDB IGNORE] (#22244) * Request Internet Sound Optional Credit User (#76453) ## About The Pull Request What this PR does is it adds a small additional feature to the Request Internet Sound verb to give users who request music an option to credit themselves for the song request. It will use character name of the person who submits the request, with the option to be anonymous. The default will make users anonymous. ## Why It's Good For The Game This differentiates songs that where requested by users and songs that admins themselves played. And allows users to give themselves credit for their 'Good' (or bad) music preferences.
Screenshot ![dreamseeker_OQyx1sZ689](https://github.com/tgstation/tgstation/assets/2568378/806347a7-a930-4993-b2d0-b1890021c662)
## Changelog :cl: qol: Request Internet Sound now has the option to credit the person who requested the Sound. Defaults to anonymous. /:cl: * Request Internet Sound Optional Credit User --------- Co-authored-by: SomeRandomOwl <2568378+SomeRandomOwl@users.noreply.github.com> Co-authored-by: lessthanthree <83487515+lessthnthree@users.noreply.github.com> --- code/__DEFINES/admin.dm | 2 +- code/modules/admin/topic.dm | 3 ++- code/modules/admin/verbs/playsound.dm | 4 +++- code/modules/admin/verbs/request_internet_sound.dm | 13 +++++++++++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/code/__DEFINES/admin.dm b/code/__DEFINES/admin.dm index e0d090a28c0..8bd2ff76311 100644 --- a/code/__DEFINES/admin.dm +++ b/code/__DEFINES/admin.dm @@ -75,7 +75,7 @@ /// Displays "(SHOW)" in the chat, when clicked it tries to show atom(paper). First you need to set the request_state variable to TRUE for the paper. #define ADMIN_SHOW_PAPER(atom) "(SHOW)" /// Displays "(PLAY)" in the chat, when clicked it tries to play internet sounds from the request. -#define ADMIN_PLAY_INTERNET(text) "(PLAY)" +#define ADMIN_PLAY_INTERNET(text, credit) "(PLAY)" /atom/proc/Admin_Coordinates_Readable(area_name, admin_jump_ref) var/turf/T = Safe_COORD_Location() diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index ba8ac9e52da..0a7b1338cd1 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -1804,9 +1804,10 @@ if(!check_rights(R_SOUND)) return + var/credit = href_list["credit"] var/link_url = href_list["play_internet"] if(!link_url) return - web_sound(usr, link_url) + web_sound(usr, link_url, credit) diff --git a/code/modules/admin/verbs/playsound.dm b/code/modules/admin/verbs/playsound.dm index 7298852f6e5..17bba0195a2 100644 --- a/code/modules/admin/verbs/playsound.dm +++ b/code/modules/admin/verbs/playsound.dm @@ -71,7 +71,7 @@ SSblackbox.record_feedback("tally", "admin_verb", 1, "Play Direct Mob Sound") // If you are copy-pasting this, ensure the 4th parameter is unique to the new proc! ///Takes an input from either proc/play_web_sound or the request manager and runs it through youtube-dl and prompts the user before playing it to the server. -/proc/web_sound(mob/user, input) +/proc/web_sound(mob/user, input, credit) if(!check_rights(R_SOUND)) return var/ytdl = CONFIG_GET(string/invoke_youtubedl) @@ -138,6 +138,8 @@ to_chat(world, span_boldannounce("An admin played: [webpage_url]"), confidential = TRUE) if("Cancel", null) return + if(credit) + to_chat(world, span_boldannounce(credit), confidential = TRUE) SSblackbox.record_feedback("nested tally", "played_url", 1, list("[user.ckey]", "[input]")) log_admin("[key_name(user)] played web sound: [input]") message_admins("[key_name(user)] played web sound: [input]") diff --git a/code/modules/admin/verbs/request_internet_sound.dm b/code/modules/admin/verbs/request_internet_sound.dm index 0711c2cd169..d61d3cc94c4 100644 --- a/code/modules/admin/verbs/request_internet_sound.dm +++ b/code/modules/admin/verbs/request_internet_sound.dm @@ -20,6 +20,15 @@ to_chat(usr, span_danger("Invalid URL. Please use a URL from one of the following sites: [replacetext(CONFIG_GET(string/request_internet_allowed), "\\", "")]"), confidential = TRUE) return + var/credit = tgui_alert(usr, "Credit yourself for requesting this song? (will show up as [usr.name])", "Credit Yourself?", list("No", "Yes", "Cancel")) + + if(credit == "Cancel" || isnull(credit)) + return + else if (credit == "Yes") + credit = "[usr.name] requested this track." + else + credit = "Someone requested this track." + log_internet_request("[src.key]/([src.name]): [request_url]") if(usr.client) if(usr.client.prefs.muted & MUTE_INTERNET_REQUEST) @@ -28,9 +37,9 @@ if(src.client.handle_spam_prevention(request_url,MUTE_INTERNET_REQUEST)) return - GLOB.requests.music_request(usr.client, request_url) + GLOB.requests.music_request(usr.client, request_url, credit) to_chat(usr, span_info("You requested: \"[request_url]\" to be played."), confidential = TRUE) - request_url = span_adminnotice("MUSIC REQUEST: [ADMIN_FULLMONTY(src)] [ADMIN_SC(src)]: [span_linkify(request_url)] [ADMIN_PLAY_INTERNET(request_url)]") + request_url = span_adminnotice("MUSIC REQUEST: [ADMIN_FULLMONTY(src)] [ADMIN_SC(src)]: [span_linkify(request_url)] [ADMIN_PLAY_INTERNET(request_url, credit)]") for(var/client/admin_client in GLOB.admins) if(admin_client.prefs.chat_toggles & CHAT_PRAYER) to_chat(admin_client, request_url, type = MESSAGE_TYPE_PRAYER, confidential = TRUE)