Skip to content

Commit

Permalink
Fax machine sfx preference (#6446)
Browse files Browse the repository at this point in the history
# About the pull request

This PR adds a preference (verb and character pref) for observers and
admins to toggle whether the fax machine sound is played directly to
their client when a fax is sent.

# Explain why it's good for the game

More preferences.

# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>


![image](https://github.com/cmss13-devs/cmss13/assets/76988376/aca4f027-bb4b-406e-89c2-a09f78a6041f)

</details>


# Changelog
:cl: Drathek
add: Added preference for toggling the fax machine received sound as an
observer
/:cl:
  • Loading branch information
Drulikar committed Jun 14, 2024
1 parent 6784e97 commit 09ad917
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
3 changes: 2 additions & 1 deletion code/__DEFINES/__game.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
#define SOUND_ADMIN_ATMOSPHERIC (1<<7)
#define SOUND_ARES_MESSAGE (1<<8)
#define SOUND_OBSERVER_ANNOUNCEMENTS (1<<9)
#define SOUND_FAX_MACHINE (1<<10)

//toggles_chat
#define CHAT_OOC (1<<0)
Expand Down Expand Up @@ -159,7 +160,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|SOUND_OBSERVER_ANNOUNCEMENTS)
#define TOGGLES_SOUND_DEFAULT (SOUND_ADMINHELP|SOUND_MIDI|SOUND_AMBIENCE|SOUND_LOBBY|SOUND_INTERNET|SOUND_ADMIN_MEME|SOUND_ADMIN_ATMOSPHERIC|SOUND_OBSERVER_ANNOUNCEMENTS|SOUND_FAX_MACHINE)

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

Expand Down
6 changes: 4 additions & 2 deletions code/game/machinery/fax_machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ GLOBAL_LIST_EMPTY(alldepartments)
to_chat(C, msg_admin)
else
to_chat(C, msg_ghost)
C << 'sound/effects/incoming-fax.ogg'
if(C.prefs?.toggles_sound & SOUND_FAX_MACHINE)
C << 'sound/effects/incoming-fax.ogg'
if(msg_ghost)
for(var/i in GLOB.observer_list)
var/mob/dead/observer/g = i
Expand All @@ -398,7 +399,8 @@ GLOBAL_LIST_EMPTY(alldepartments)
if((R_ADMIN|R_MOD) & C.admin_holder.rights) //staff don't need to see the fax twice
continue
to_chat(C, msg_ghost)
C << 'sound/effects/incoming-fax.ogg'
if(C.prefs?.toggles_sound & SOUND_FAX_MACHINE)
C << 'sound/effects/incoming-fax.ogg'


/obj/structure/machinery/faxmachine/proc/send_fax(datum/fax/faxcontents)
Expand Down
4 changes: 4 additions & 0 deletions code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ GLOBAL_LIST_INIT(bgstate_options, list(
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>Play Fax Sounds As Ghost:</b> <a href='?_src_=prefs;preference=hear_faxes'><b>[(toggles_sound & SOUND_FAX_MACHINE) ? "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>Set Flash Type:</b> <a href='?src=\ref[src];action=proccall;procpath=/client/proc/set_flash_type'>Set</a><br>"
Expand Down Expand Up @@ -1850,6 +1851,9 @@ GLOBAL_LIST_INIT(bgstate_options, list(
if("hear_observer_announcements")
toggles_sound ^= SOUND_OBSERVER_ANNOUNCEMENTS

if("hear_faxes")
toggles_sound ^= SOUND_FAX_MACHINE

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 23
#define SAVEFILE_VERSION_MAX 24

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

if(savefile_version < 24) // adds fax machine sounds on by default
var/sound_toggles
S["toggles_sound"] >> sound_toggles
sound_toggles |= (SOUND_FAX_MACHINE)
S["toggles_sound"] << sound_toggles

savefile_version = SAVEFILE_VERSION_MAX
return 1

Expand Down
10 changes: 9 additions & 1 deletion code/modules/client/preferences_toggles.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
if(!admin_holder) return
prefs.toggles_sound ^= SOUND_ADMINHELP
prefs.save_preferences()
to_chat(usr,SPAN_BOLDNOTICE( "You will [(prefs.toggles_sound & SOUND_ADMINHELP) ? "now" : "no longer"] hear a sound when adminhelps arrive."))
to_chat(usr, SPAN_BOLDNOTICE("You will [(prefs.toggles_sound & SOUND_ADMINHELP) ? "now" : "no longer"] hear a sound when adminhelps arrive."))

/client/proc/toggleprayers()
set name = "Show/Hide Prayers"
Expand All @@ -33,6 +33,14 @@
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/toggle_fax_machine_sounds()
set name = "Hear/Silence Ghost Fax Machines"
set category = "Preferences.Sound"
set desc = "Toggle hearing a notification of faxes while being an observer."
prefs.toggles_sound ^= SOUND_FAX_MACHINE
prefs.save_preferences()
to_chat(usr, SPAN_BOLDNOTICE("You will [(prefs.toggles_sound & SOUND_FAX_MACHINE) ? "now" : "no longer"] hear a fax sounds as an observer."))

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

0 comments on commit 09ad917

Please sign in to comment.