Skip to content

Commit

Permalink
Adds an option to mute announcements while being an observer (#5895)
Browse files Browse the repository at this point in the history
# About the pull request

Adds a verb called `Hear/Silence Ghost Announcements`, accessible via
the Preferences tab and in Character Setup. It toggles the announcement
audio cue (queen screech, CIC beep, etc.) while the player is being an
**observer**. It does not affect in-character audio.

~~Slight issue with the PR right now is that it makes every current
player's announcements silent by default, it only turns on when creating
new prefs (if I did that correctly). I assume I would need @harryob for
updating our current players' prefs for this?~~

Edit: Updated the savefile with harry's guidance so it is turned on by
default for existing players as well.

# Explain why it's good for the game

Sometimes you tab out of the game for a few minutes, but god forbid you
are trying to watch YouTube or just chilling, because CIC and the Queen
are both spamming their ear-destroying announcements.

I assume this would be nice for staff too who are only online to listen
to ahelps.

# Testing Photographs and Procedure

1. Toggle the preference via the Preferences tab
2. Use the Report: verbs in the Admin tab

# Changelog

:cl:
add: Added an option to hear or silence announcement audio cues (queen
screech, CIC beep, etc.) while being an observer.
/:cl:

---------

Co-authored-by: Drathek <[email protected]>
Co-authored-by: SabreML <[email protected]>
  • Loading branch information
3 people authored Mar 13, 2024
1 parent b6ccb62 commit a0c26a5
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
3 changes: 2 additions & 1 deletion code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
#define SOUND_ADMIN_MEME (1<<6)
#define SOUND_ADMIN_ATMOSPHERIC (1<<7)
#define SOUND_ARES_MESSAGE (1<<8)
#define SOUND_OBSERVER_ANNOUNCEMENTS (1<<9)

//toggles_chat
#define CHAT_OOC (1<<0)
Expand Down Expand Up @@ -156,7 +157,7 @@

#define TOGGLES_LANGCHAT_DEFAULT (LANGCHAT_SEE_EMOTES)

#define TOGGLES_SOUND_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|SOUND_INTERNET|SOUND_ADMIN_MEME|SOUND_ADMIN_ATMOSPHERIC)
#define TOGGLES_SOUND_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|SOUND_INTERNET|SOUND_ADMIN_MEME|SOUND_ADMIN_ATMOSPHERIC|SOUND_OBSERVER_ANNOUNCEMENTS)

#define TOGGLES_FLASHING_DEFAULT (FLASH_ROUNDSTART|FLASH_ROUNDEND|FLASH_CORPSEREVIVE|FLASH_ADMINPM|FLASH_UNNEST)

Expand Down
4 changes: 3 additions & 1 deletion code/defines/procs/announcement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
//AI announcement that uses talking into comms
/proc/ai_announcement(message, sound_to_play = sound('sound/misc/interference.ogg'), logging = ARES_LOG_MAIN)
for(var/mob/M in (GLOB.human_mob_list + GLOB.dead_mob_list))
if(isobserver(M) || ishuman(M) && is_mainship_level(M.z))
if((isobserver(M) && M.client?.prefs?.toggles_sound & SOUND_OBSERVER_ANNOUNCEMENTS) || ishuman(M) && is_mainship_level(M.z))
playsound_client(M.client, sound_to_play, M, vol = 45)

for(var/mob/living/silicon/decoy/ship_ai/AI in GLOB.ai_mob_list)
Expand Down Expand Up @@ -161,4 +161,6 @@
continue

to_chat_spaced(T, html = "[SPAN_ANNOUNCEMENT_HEADER(title)]<br><br>[SPAN_ANNOUNCEMENT_BODY(message)]", type = MESSAGE_TYPE_RADIO)
if(isobserver(T) && !(T.client?.prefs?.toggles_sound & SOUND_OBSERVER_ANNOUNCEMENTS))
return
playsound_client(T.client, sound_to_play, T, vol = 45)
4 changes: 4 additions & 0 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ GLOBAL_LIST_INIT(bgstate_options, list(
dat += "<b>tgui Window Mode:</b> <a href='?_src_=prefs;preference=tgui_fancy'><b>[(tgui_fancy) ? "Fancy (default)" : "Compatible (slower)"]</b></a><br>"
dat += "<b>tgui Window Placement:</b> <a href='?_src_=prefs;preference=tgui_lock'><b>[(tgui_lock) ? "Primary monitor" : "Free (default)"]</b></a><br>"
dat += "<b>Play Admin Sounds:</b> <a href='?_src_=prefs;preference=hear_admin_sounds'><b>[(toggles_sound & SOUND_MIDI) ? "Yes" : "No"]</b></a><br>"
dat += "<b>Play Announcement Sounds As Ghost:</b> <a href='?_src_=prefs;preference=hear_observer_announcements'><b>[(toggles_sound & SOUND_OBSERVER_ANNOUNCEMENTS) ? "Yes" : "No"]</b></a><br>"
dat += "<b>Toggle Meme or Atmospheric Sounds:</b> <a href='?src=\ref[src];action=proccall;procpath=/client/proc/toggle_admin_sound_types'>Toggle</a><br>"
dat += "<b>Set Eye Blur Type:</b> <a href='?src=\ref[src];action=proccall;procpath=/client/proc/set_eye_blur_type'>Set</a><br>"
dat += "<b>Play Lobby Music:</b> <a href='?_src_=prefs;preference=lobby_music'><b>[(toggles_sound & SOUND_LOBBY) ? "Yes" : "No"]</b></a><br>"
Expand Down Expand Up @@ -1819,6 +1820,9 @@ GLOBAL_LIST_INIT(bgstate_options, list(
if(!(toggles_sound & SOUND_MIDI))
user?.client?.tgui_panel?.stop_music()

if("hear_observer_announcements")
toggles_sound ^= SOUND_OBSERVER_ANNOUNCEMENTS

if("lobby_music")
toggles_sound ^= SOUND_LOBBY
if(toggles_sound & SOUND_LOBBY)
Expand Down
8 changes: 7 additions & 1 deletion code/modules/client/preferences_savefile.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define SAVEFILE_VERSION_MIN 8
#define SAVEFILE_VERSION_MAX 21
#define SAVEFILE_VERSION_MAX 22

//handles converting savefiles to new formats
//MAKE SURE YOU KEEP THIS UP TO DATE!
Expand Down Expand Up @@ -89,6 +89,12 @@
dual_wield_pref = DUAL_WIELD_FIRE
S["dual_wield_pref"] << dual_wield_pref

if(savefile_version < 22)
var/sound_toggles
S["toggles_sound"] >> sound_toggles
sound_toggles |= SOUND_OBSERVER_ANNOUNCEMENTS
S["toggles_sound"] << sound_toggles

savefile_version = SAVEFILE_VERSION_MAX
return 1

Expand Down
8 changes: 8 additions & 0 deletions code/modules/client/preferences_toggles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@
prefs.save_preferences()
to_chat(src, SPAN_BOLDNOTICE("You will [(prefs.toggles_chat & CHAT_PRAYER) ? "now" : "no longer"] see prayerchat."))

/client/verb/toggle_observer_announcement_sounds()
set name = "Hear/Silence Ghost Announcements"
set category = "Preferences.Sound"
set desc = "Toggle hearing a notification of announcements while being an observer."
prefs.toggles_sound ^= SOUND_OBSERVER_ANNOUNCEMENTS
prefs.save_preferences()
to_chat(usr, SPAN_BOLDNOTICE("You will [(prefs.toggles_sound & SOUND_OBSERVER_ANNOUNCEMENTS) ? "now" : "no longer"] hear announcement sounds as an observer."))

/client/verb/toggletitlemusic()
set name = "Hear/Silence LobbyMusic"
set category = "Preferences.Sound"
Expand Down

0 comments on commit a0c26a5

Please sign in to comment.