mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
Fixes and QOL for the "Request Internet sound" verb (#93244)
## About The Pull Request Fixes inverted `tgui_input` arguments. Prettifies both admin and user outputs. https://github.com/user-attachments/assets/e91bc950-0117-42b4-add0-45de2295744d <img width="687" height="202" alt="image" src="https://github.com/user-attachments/assets/23b6fa14-016d-4357-ae9b-7121226be4a8" /> ## Why It's Good For The Game Cleaner code, looks better ingame ## Changelog 🆑 qol: Better output for sound requesting fix: "Request Internet sound" input window's title and description are not inverted anymore /🆑 --------- Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
@@ -20,7 +20,7 @@ ADMIN_VERB(play_sound, R_SOUND, "Play Global Sound", "Play a sound to all connec
|
||||
admin_sound.status = SOUND_STREAM
|
||||
admin_sound.volume = vol
|
||||
|
||||
var/res = tgui_alert(user, "Show the title of this song to the players?",, list("Yes","No", "Cancel"))
|
||||
var/res = tgui_alert(user, "Show the title of this song to the players?", "Play Sound", list("Yes", "No", "Cancel"))
|
||||
switch(res)
|
||||
if("Yes")
|
||||
to_chat(world, span_boldannounce("An admin played: [sound]"), confidential = TRUE)
|
||||
@@ -104,34 +104,44 @@ GLOBAL_VAR_INIT(web_sound_cooldown, 0)
|
||||
music_extra_data["album"] = data["album"]
|
||||
duration = data["duration"] * 1 SECONDS
|
||||
if (duration > 10 MINUTES)
|
||||
if((tgui_alert(user, "This song is over 10 minutes long. Are you sure you want to play it?", "Length Warning!", list("No", "Yes", "Cancel")) != "Yes"))
|
||||
if((tgui_alert(user, "This song is over 10 minutes long. Are you sure you want to play it?", "Length Warning", list("No", "Yes", "Cancel")) != "Yes"))
|
||||
return
|
||||
var/res = tgui_alert(user, "Show the title of and link to this song to the players?\n[title]", "Show Info?", list("Yes", "No", "Cancel"))
|
||||
switch(res)
|
||||
var/include_song_data = tgui_alert(user, "Show the title of and link to this song to the players?\n[title]", "Song Info", list("Yes", "No", "Cancel"))
|
||||
switch(include_song_data)
|
||||
if("Yes")
|
||||
music_extra_data["title"] = data["title"]
|
||||
music_extra_data["artist"] = data["artist"]
|
||||
if("No")
|
||||
music_extra_data["link"] = "Song Link Hidden"
|
||||
music_extra_data["title"] = "Song Title Hidden"
|
||||
music_extra_data["artist"] = "Song Artist Hidden"
|
||||
music_extra_data["upload_date"] = "Song Upload Date Hidden"
|
||||
music_extra_data["album"] = "Song Album Hidden"
|
||||
music_extra_data["link"] = "\[\[HYPERLINK BLOCKED\]\]"
|
||||
music_extra_data["title"] = "Untitled"
|
||||
music_extra_data["artist"] = "Unknown"
|
||||
music_extra_data["upload_date"] = "XX.YY.ZZZZ"
|
||||
music_extra_data["album"] = "Default"
|
||||
if("Cancel", null)
|
||||
return
|
||||
var/anon = tgui_alert(user, "Display who played the song?", "Credit Yourself?", list("Yes", "No", "Cancel"))
|
||||
switch(anon)
|
||||
if("Yes")
|
||||
if(res == "Yes")
|
||||
to_chat(world, span_boldannounce("[user.key] played: [webpage_url]"), confidential = TRUE)
|
||||
var/stay_anonimous = tgui_alert(user, "Display who played the song?", "Credit Yourself", list("Yes", "No", "Cancel"))
|
||||
|
||||
var/list/to_chat_message = list()
|
||||
|
||||
switch(stay_anonimous)
|
||||
if("No")
|
||||
if(include_song_data == "Yes")
|
||||
to_chat_message += span_notice("[user.ckey] played: [span_linkify(webpage_url)]")
|
||||
else
|
||||
to_chat(world, span_boldannounce("[user.key] played a sound"), confidential = TRUE)
|
||||
if("No")
|
||||
if(res == "Yes")
|
||||
to_chat(world, span_boldannounce("An admin played: [webpage_url]"), confidential = TRUE)
|
||||
to_chat_message += span_notice("[user.ckey] played a sound.")
|
||||
if("Yes")
|
||||
if(include_song_data == "Yes")
|
||||
to_chat_message += span_notice("An admin played: [span_linkify(webpage_url)]")
|
||||
else
|
||||
to_chat_message += span_notice("An admin played a sound.")
|
||||
if("Cancel", null)
|
||||
return
|
||||
|
||||
if(credit)
|
||||
to_chat(world, span_boldannounce(credit), confidential = TRUE)
|
||||
to_chat_message += span_notice("<br>[credit]")
|
||||
|
||||
to_chat(world, fieldset_block("Now Playing: [span_bold(music_extra_data["title"])] by [span_bold(music_extra_data["artist"])]", jointext(to_chat_message, ""), "boxed_message"))
|
||||
|
||||
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]")
|
||||
|
||||
@@ -2,32 +2,28 @@
|
||||
set category = "OOC"
|
||||
set name = "Request Internet Sound"
|
||||
|
||||
if(GLOB.say_disabled) //This is here to try to identify lag problems
|
||||
to_chat(usr, span_danger("Speech is currently admin-disabled."), confidential = TRUE)
|
||||
return
|
||||
|
||||
if (!CONFIG_GET(flag/request_internet_sound))
|
||||
if(!CONFIG_GET(flag/request_internet_sound))
|
||||
to_chat(usr, span_danger("This server has disabled internet sound requests."), confidential = TRUE)
|
||||
return
|
||||
|
||||
var/request_url = tgui_input_text(usr, "Please Input a URL", "Only certain sites are allowed, such as YouTube, SoundCloud, and Bandcamp.", "")
|
||||
var/request_url = tgui_input_text(usr, "Please input a URL. Supported sources: [replacetext(replacetext(CONFIG_GET(string/request_internet_allowed), "\\", ""), ",", ", ")].", "Request Intenet sound")
|
||||
if(!request_url)
|
||||
return
|
||||
|
||||
//regex filter
|
||||
var/regex/allowed_regex = regex(replacetext(CONFIG_GET(string/request_internet_allowed), ",", "|"), "i")
|
||||
if(!allowed_regex.Find(request_url))
|
||||
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)
|
||||
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.ckey])", "Credit Yourself?", list("No", "Yes", "Cancel"))
|
||||
|
||||
if(credit == "Cancel" || isnull(credit))
|
||||
return
|
||||
|
||||
else if (credit == "Yes")
|
||||
credit = "[usr.ckey] requested this track."
|
||||
else
|
||||
credit = "Someone requested this track."
|
||||
credit = null
|
||||
|
||||
log_internet_request("[src.key]/([src.name]): [request_url]")
|
||||
if(usr.client)
|
||||
@@ -38,10 +34,14 @@
|
||||
return
|
||||
|
||||
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("<b><font color='cyan'>MUSIC REQUEST: </font>[ADMIN_FULLMONTY(src)] [ADMIN_SC(src)]:</b> [span_linkify(request_url)] [ADMIN_PLAY_INTERNET(request_url, credit)]")
|
||||
to_chat(usr, span_info("You requested [span_linkify(request_url)] to be played."), confidential = TRUE)
|
||||
|
||||
var/list/admin_message = list()
|
||||
admin_message += ("[ADMIN_FULLMONTY(src)] [ADMIN_SC(src)] has requested the following to be played:<br>")
|
||||
admin_message += ("[span_linkify(request_url)] [ADMIN_PLAY_INTERNET(request_url, credit)]")
|
||||
|
||||
for(var/client/admin_client in GLOB.admins)
|
||||
if(get_chat_toggles(admin_client) & CHAT_PRAYER)
|
||||
to_chat(admin_client, request_url, type = MESSAGE_TYPE_PRAYER, confidential = TRUE)
|
||||
to_chat(admin_client, fieldset_block("Internet sound requested", jointext(admin_message, ""), "boxed_message"), type = MESSAGE_TYPE_PRAYER, confidential = TRUE)
|
||||
|
||||
SSblackbox.record_feedback("tally", "music_request", 1, "Music Request") // If you are copy-pasting this, ensure the 4th parameter is unique to the new proc!
|
||||
|
||||
Reference in New Issue
Block a user