Files
Bubberstation/code/modules/admin/verbs/request_internet_sound.dm
ff006aa4a5 verb macro system (pr 1/3) (#96720)
## About The Pull Request

just macro-izes all the usages of verbs in the codebase as a
pre-requisite to my follow up pr that serializes all the verbs arguments
so we can tgui-ify the command bar, so we can then put it on the
onscreen map.

this also basically does the same as #94487 so can easily be integrated
into the verb queueing stuff... but does not actually do any verb
queueing by itself. basically im just trying to be
https://github.com/tgstation/tgstation/labels/Atomic
## Why It's Good For The Game
it doesn't really do anything by itself but it does let us do more stuff

## Changelog
🆑
code: the backend to all verbs in the game has been played with, please
report any issues to github
/🆑

---------

Co-authored-by: harryob <55142896+harryob@users.noreply.github.com>
2026-07-04 02:45:07 -04:00

45 lines
2.2 KiB
Plaintext

GAME_VERB(/mob, request_internet_sound, "Request Internet Sound", "OOC")
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. Supported sources: [replacetext(replacetext(CONFIG_GET(string/request_internet_allowed), "\\", ""), ",", ", ")].", "Request Intenet sound")
if(!request_url)
return
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)
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 = null
log_internet_request("[src.key]/([src.name]): [request_url]")
if(usr.client)
if(usr.client.prefs.muted & MUTE_INTERNET_REQUEST)
to_chat(usr, span_danger("You cannot request music at this time. (muted)."), confidential = TRUE)
return
if(src.client.handle_spam_prevention(request_url,MUTE_INTERNET_REQUEST))
return
GLOB.requests.music_request(usr.client, 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, 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!