[MIRROR] Fixes stopsounds properly (#5931)
* Fixes stopsounds properly (#36341) * Revert "Merge pull request #36340 from vuonojenmustaturska/beelogreen" This reverts commit 259838f38cfda32619e34cf41d57df4d45b75363, reversing changes made to 111cd316a92f5f5840d96b1fc4bbe4cb7b1ce6fd. * Fixes stopsounds properly Also I forgot to actually block admins from bad protocols it just showed them a message that it was blocked but didn't block it * Fixes stopsounds properly
This commit is contained in:
committed by
Poojawa
parent
8dc9fcf816
commit
dff9dabf06
@@ -433,8 +433,6 @@ GLOBAL_LIST_INIT(ghost_others_options, list(GHOST_OTHERS_SIMPLE, GHOST_OTHERS_DE
|
|||||||
#define SUMMON_GUNS "guns"
|
#define SUMMON_GUNS "guns"
|
||||||
#define SUMMON_MAGIC "magic"
|
#define SUMMON_MAGIC "magic"
|
||||||
|
|
||||||
#define STOP_SOUNDS_URL "http://"
|
|
||||||
|
|
||||||
//Run the world with this parameter to enable a single run though of the game setup and tear down process with unit tests in between
|
//Run the world with this parameter to enable a single run though of the game setup and tear down process with unit tests in between
|
||||||
#define TEST_RUN_PARAMETER "test-run"
|
#define TEST_RUN_PARAMETER "test-run"
|
||||||
//Force the log directory to be something specific in the data/logs folder
|
//Force the log directory to be something specific in the data/logs folder
|
||||||
|
|||||||
@@ -70,6 +70,7 @@
|
|||||||
var/web_sound_input = input("Enter content URL (supported sites only, leave blank to stop playing)", "Play Internet Sound via youtube-dl") as text|null
|
var/web_sound_input = input("Enter content URL (supported sites only, leave blank to stop playing)", "Play Internet Sound via youtube-dl") as text|null
|
||||||
if(istext(web_sound_input))
|
if(istext(web_sound_input))
|
||||||
var/web_sound_url = ""
|
var/web_sound_url = ""
|
||||||
|
var/stop_web_sounds = FALSE
|
||||||
var/pitch
|
var/pitch
|
||||||
if(length(web_sound_input))
|
if(length(web_sound_input))
|
||||||
|
|
||||||
@@ -120,17 +121,22 @@
|
|||||||
else //pressed ok with blank
|
else //pressed ok with blank
|
||||||
log_admin("[key_name(src)] stopped web sound")
|
log_admin("[key_name(src)] stopped web sound")
|
||||||
message_admins("[key_name(src)] stopped web sound")
|
message_admins("[key_name(src)] stopped web sound")
|
||||||
web_sound_url = STOP_SOUNDS_URL
|
web_sound_url = null
|
||||||
|
stop_web_sounds = TRUE
|
||||||
|
|
||||||
if(web_sound_url)
|
if(web_sound_url && !findtext(web_sound_url, GLOB.is_http_protocol))
|
||||||
if(!findtext(web_sound_url, GLOB.is_http_protocol))
|
to_chat(src, "<span class='boldwarning'>BLOCKED: Content URL not using http(s) protocol</span>")
|
||||||
to_chat(src, "<span class='boldwarning'>BLOCKED: Content URL not using http(s) protocol</span>")
|
to_chat(src, "<span class='warning'>The media provider returned a content URL that isn't using the HTTP or HTTPS protocol</span>")
|
||||||
to_chat(src, "<span class='warning'>The media provider returned a content URL that isn't using the HTTP or HTTPS protocol</span>")
|
return
|
||||||
|
if(web_sound_url || stop_web_sounds)
|
||||||
for(var/m in GLOB.player_list)
|
for(var/m in GLOB.player_list)
|
||||||
var/mob/M = m
|
var/mob/M = m
|
||||||
var/client/C = M.client
|
var/client/C = M.client
|
||||||
if((C.prefs.toggles & SOUND_MIDI) && C.chatOutput && !C.chatOutput.broken && C.chatOutput.loaded)
|
if((C.prefs.toggles & SOUND_MIDI) && C.chatOutput && !C.chatOutput.broken && C.chatOutput.loaded)
|
||||||
C.chatOutput.sendMusic(web_sound_url, pitch)
|
if(!stop_web_sounds)
|
||||||
|
C.chatOutput.sendMusic(web_sound_url, pitch)
|
||||||
|
else
|
||||||
|
C.chatOutput.stopMusic()
|
||||||
|
|
||||||
SSblackbox.record_feedback("tally", "admin_verb", 1, "Play Internet Sound")
|
SSblackbox.record_feedback("tally", "admin_verb", 1, "Play Internet Sound")
|
||||||
|
|
||||||
@@ -159,5 +165,5 @@
|
|||||||
SEND_SOUND(M, sound(null))
|
SEND_SOUND(M, sound(null))
|
||||||
var/client/C = M.client
|
var/client/C = M.client
|
||||||
if(C && C.chatOutput && !C.chatOutput.broken && C.chatOutput.loaded)
|
if(C && C.chatOutput && !C.chatOutput.broken && C.chatOutput.loaded)
|
||||||
C.chatOutput.sendMusic(STOP_SOUNDS_URL)
|
C.chatOutput.stopMusic()
|
||||||
SSblackbox.record_feedback("tally", "admin_verb", 1, "Stop All Playing Sounds") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
SSblackbox.record_feedback("tally", "admin_verb", 1, "Stop All Playing Sounds") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, togglemidis)()
|
|||||||
usr.stop_sound_channel(CHANNEL_ADMIN)
|
usr.stop_sound_channel(CHANNEL_ADMIN)
|
||||||
var/client/C = usr.client
|
var/client/C = usr.client
|
||||||
if(C && C.chatOutput && !C.chatOutput.broken && C.chatOutput.loaded)
|
if(C && C.chatOutput && !C.chatOutput.broken && C.chatOutput.loaded)
|
||||||
C.chatOutput.sendMusic(" ")
|
C.chatOutput.stopMusic()
|
||||||
SSblackbox.record_feedback("nested tally", "preferences_verb", 1, list("Toggle Hearing Midis", "[usr.client.prefs.toggles & SOUND_MIDI ? "Enabled" : "Disabled"]")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
SSblackbox.record_feedback("nested tally", "preferences_verb", 1, list("Toggle Hearing Midis", "[usr.client.prefs.toggles & SOUND_MIDI ? "Enabled" : "Disabled"]")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||||
/datum/verbs/menu/Settings/Sound/togglemidis/Get_checked(client/C)
|
/datum/verbs/menu/Settings/Sound/togglemidis/Get_checked(client/C)
|
||||||
return C.prefs.toggles & SOUND_MIDI
|
return C.prefs.toggles & SOUND_MIDI
|
||||||
@@ -235,7 +235,7 @@ TOGGLE_CHECKBOX(/datum/verbs/menu/Settings/Sound, toggleprayersounds)()
|
|||||||
SEND_SOUND(usr, sound(null))
|
SEND_SOUND(usr, sound(null))
|
||||||
var/client/C = usr.client
|
var/client/C = usr.client
|
||||||
if(C && C.chatOutput && !C.chatOutput.broken && C.chatOutput.loaded)
|
if(C && C.chatOutput && !C.chatOutput.broken && C.chatOutput.loaded)
|
||||||
C.chatOutput.sendMusic(STOP_SOUNDS_URL)
|
C.chatOutput.stopMusic()
|
||||||
SSblackbox.record_feedback("nested tally", "preferences_verb", 1, list("Stop Self Sounds")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
SSblackbox.record_feedback("nested tally", "preferences_verb", 1, list("Stop Self Sounds")) //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -132,6 +132,9 @@ GLOBAL_DATUM_INIT(iconCache, /savefile, new("data/iconCache.sav")) //Cache of ic
|
|||||||
music_data["musicRate"] = pitch
|
music_data["musicRate"] = pitch
|
||||||
ehjax_send(data = music_data)
|
ehjax_send(data = music_data)
|
||||||
|
|
||||||
|
/datum/chatOutput/proc/stopMusic()
|
||||||
|
ehjax_send(data = "stopMusic")
|
||||||
|
|
||||||
/datum/chatOutput/proc/setMusicVolume(volume = "")
|
/datum/chatOutput/proc/setMusicVolume(volume = "")
|
||||||
if(volume)
|
if(volume)
|
||||||
adminMusicVolume = CLAMP(text2num(volume), 0, 100)
|
adminMusicVolume = CLAMP(text2num(volume), 0, 100)
|
||||||
|
|||||||
@@ -442,6 +442,8 @@ function ehjaxCallback(data) {
|
|||||||
} else if (data == 'roundrestart') {
|
} else if (data == 'roundrestart') {
|
||||||
opts.restarting = true;
|
opts.restarting = true;
|
||||||
internalOutput('<div class="connectionClosed internal restarting">The connection has been closed because the server is restarting. Please wait while you automatically reconnect.</div>', 'internal');
|
internalOutput('<div class="connectionClosed internal restarting">The connection has been closed because the server is restarting. Please wait while you automatically reconnect.</div>', 'internal');
|
||||||
|
} else if (data == 'stopMusic') {
|
||||||
|
$('#adminMusic').prop('src', '');
|
||||||
} else {
|
} else {
|
||||||
//Oh we're actually being sent data instead of an instruction
|
//Oh we're actually being sent data instead of an instruction
|
||||||
var dataJ;
|
var dataJ;
|
||||||
|
|||||||
Reference in New Issue
Block a user