diff --git a/code/_globalvars/lists/mobs.dm b/code/_globalvars/lists/mobs.dm index 04d4c2888a..959a62ebf8 100644 --- a/code/_globalvars/lists/mobs.dm +++ b/code/_globalvars/lists/mobs.dm @@ -43,15 +43,26 @@ GLOBAL_LIST_EMPTY(mob_config_movespeed_type_lookup) GLOBAL_LIST_EMPTY(latejoiners) //CIT CHANGE - All latejoining people, for traitor-target purposes. /proc/update_config_movespeed_type_lookup(update_mobs = TRUE) - var/list/mob_types = list() + // NOTE: This is entirely based on the fact that byond typesof/subtypesof gets longer/deeper paths before shallower ones. + // If that ever breaks this entire proc breaks. + var/list/mob_types = typesof(/mob) var/list/entry_value = CONFIG_GET(keyed_list/multiplicative_movespeed) + var/list/configured_types = list() for(var/path in entry_value) var/value = entry_value[path] - if(!value) + if(isnull(value)) continue + // associative list sets for elements that already exist preserve order + mob_types[path] = value + // now go back up through it to set everything, making absolute sure that base paths are overridden by child paths all the way down the path tree. + for(var/i in length(mob_types) to 1 step -1) + var/path = mob_types[i] + if(isnull(mob_types[path])) + continue + // we're going from bottom to top so it should be safe to do this without further checks.. for(var/subpath in typesof(path)) - mob_types[subpath] = value - GLOB.mob_config_movespeed_type_lookup = mob_types + configured_types[subpath] = mob_types[path] + GLOB.mob_config_movespeed_type_lookup = configured_types if(update_mobs) update_mob_config_movespeeds() diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index b040c88a49..e9b8c274a8 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -81,7 +81,7 @@ GLOBAL_PROTECT(admin_verbs_admin) ) GLOBAL_LIST_INIT(admin_verbs_ban, list(/client/proc/unban_panel, /client/proc/DB_ban_panel, /client/proc/stickybanpanel)) GLOBAL_PROTECT(admin_verbs_ban) -GLOBAL_LIST_INIT(admin_verbs_sounds, list(/client/proc/play_local_sound, /client/proc/play_sound, /client/proc/set_round_end_sound)) +GLOBAL_LIST_INIT(admin_verbs_sounds, list(/client/proc/play_local_sound, /client/proc/play_sound, /client/proc/manual_play_web_sound, /client/proc/set_round_end_sound)) GLOBAL_PROTECT(admin_verbs_sounds) GLOBAL_LIST_INIT(admin_verbs_fun, list( /client/proc/cmd_admin_dress, diff --git a/code/modules/admin/verbs/playsound.dm b/code/modules/admin/verbs/playsound.dm index 066c38bcba..e7b9342645 100644 --- a/code/modules/admin/verbs/playsound.dm +++ b/code/modules/admin/verbs/playsound.dm @@ -138,6 +138,49 @@ SSblackbox.record_feedback("tally", "admin_verb", 1, "Play Internet Sound") +/client/proc/manual_play_web_sound() + set category = "Fun" + set name = "Manual Play Internet Sound" + if(!check_rights(R_SOUNDS)) + return + + var/web_sound_input = input("Enter content stream URL (fetch this from local youtube-dl!)", "Play Internet Sound via direct URL") as text|null + if(istext(web_sound_input)) + if(!length(web_sound_input)) + log_admin("[key_name(src)] stopped web sound") + message_admins("[key_name(src)] stopped web sound") + var/mob/M + for(var/i in GLOB.player_list) + M = i + M?.client?.chatOutput?.stopMusic() + return + else + if(web_sound_input && !findtext(web_sound_input, GLOB.is_http_protocol)) + to_chat(src, "BLOCKED: Content URL not using http(s) protocol") + return + var/freq = input(usr, "What frequency would you like the sound to play at?",, 1) as null|num + if(isnull(freq)) + return + if(!freq) + freq = 1 + SSblackbox.record_feedback("nested tally", "played_url", 1, list("[ckey]", "[web_sound_input]")) + var/logstr = "[key_name(src)] played web sound at freq [freq]: [web_sound_input]" + log_admin(logstr) + message_admins(logstr) + var/mob/M + var/client/C + var/datum/chatOutput/O + for(var/i in GLOB.player_list) + M = i + C = M.client + if(!(C?.prefs?.toggles & SOUND_MIDI)) + continue + O = C.chatOutput + if(!O || O.broken || !O.loaded) + continue + O.sendMusic(web_sound_input, freq) + SSblackbox.record_feedback("tally", "admin_verb", 1, "Manual Play Internet Sound") + /client/proc/set_round_end_sound(S as sound) set category = "Fun" set name = "Set Round End Sound"