Adds a pref for hearing instrument sounds (#9416)

Suggested here https://forums.aurorastation.org/topic/14618-please-for-the-love-of-god-add-a-preference-toggle-for-musical-instrument-sounds/?_fromLogin=1

Did I miss any instruments?
This commit is contained in:
mikomyazaki
2020-07-26 12:28:26 +03:00
committed by GitHub
parent aa4ffc8959
commit 9a6168e10a
7 changed files with 39 additions and 9 deletions
@@ -0,0 +1,5 @@
--
-- Set default 'On' for 'asfx_instruments'
--
UPDATE `ss13_player_preferences` SET `asfx_togs` = `asfx_togs` | 128;
+2 -1
View File
@@ -74,8 +74,9 @@
#define ASFX_DROPSOUND 16
#define ASFX_ARCADE 32
#define ASFX_RADIO 64
#define ASFX_INSTRUMENT 128
#define ASFX_DEFAULT (ASFX_AMBIENCE|ASFX_FOOTSTEPS|ASFX_VOTE|ASFX_VOX|ASFX_DROPSOUND|ASFX_ARCADE|ASFX_RADIO)
#define ASFX_DEFAULT (ASFX_AMBIENCE|ASFX_FOOTSTEPS|ASFX_VOTE|ASFX_VOX|ASFX_DROPSOUND|ASFX_ARCADE|ASFX_RADIO|ASFX_INSTRUMENT)
// For secHUDs and medHUDs and variants. The number is the location of the image on the list hud_list of humans.
#define HEALTH_HUD 1 // A simple line reading the pulse.
+3 -1
View File
@@ -189,7 +189,9 @@
if("Cn9") soundfile = 'sound/violin/Cn9.mid'
else return
hearers(15, get_turf(src)) << sound(soundfile)
var/turf/source = get_turf(src)
for(var/mob/M in hearers(15, source))
M.playsound_simple(source, file(soundfile), 100, falloff = 5, required_asfx_toggles = ASFX_INSTRUMENT)
/obj/item/device/violin/proc/playsong()
do
+1 -1
View File
@@ -209,7 +209,7 @@
//hearers(15, src) << sound(soundfile)
var/turf/source = get_turf(src)
for(var/mob/M in hearers(15, source))
M.playsound_simple(source, file(soundfile), 100, falloff = 5)
M.playsound_simple(source, file(soundfile), 100, falloff = 5, required_asfx_toggles = ASFX_INSTRUMENT)
/obj/structure/device/piano/proc/playsong()
do
+6 -3
View File
@@ -363,11 +363,14 @@ var/list/bodyfall_machine_sound = list(
else
return ..()
/mob/proc/playsound_to(turf/source_turf, sound/original_sound, use_random_freq, modify_environment = TRUE, use_pressure = TRUE)
/mob/proc/playsound_to(turf/source_turf, sound/original_sound, use_random_freq, modify_environment = TRUE, use_pressure = TRUE, required_preferences = 0, required_asfx_toggles = 0)
var/sound/S = copy_sound(original_sound)
var/pressure_factor = 1.0
if(!sound_can_play(required_preferences, required_asfx_toggles))
return 0
if (use_random_freq)
S.frequency = get_rand_frequency()
@@ -409,10 +412,10 @@ var/list/bodyfall_machine_sound = list(
return S.volume
/mob/proc/playsound_simple(source, soundin, volume, use_random_freq = FALSE, frequency = 0, falloff = 0, use_pressure = TRUE)
/mob/proc/playsound_simple(source, soundin, volume, use_random_freq = FALSE, frequency = 0, falloff = 0, use_pressure = TRUE, required_preferences = 0, required_asfx_toggles = 0)
var/sound/S = playsound_get_sound(soundin, volume, falloff, frequency)
playsound_to(source ? get_turf(source) : null, S, use_random_freq, use_pressure = use_pressure)
playsound_to(source ? get_turf(source) : null, S, use_random_freq, use_pressure = use_pressure, required_preferences = required_preferences, required_asfx_toggles = required_asfx_toggles)
/client/proc/playtitlemusic()
if(!SSticker.login_music) return
+16 -3
View File
@@ -5,13 +5,14 @@
/client/proc/toggle_vox_voice,
/client/proc/Toggle_dropsounds,
/client/proc/Toggle_arcadesounds,
/client/proc/Toggle_radiosounds
/client/proc/Toggle_radiosounds,
/client/proc/Toggle_instrumentsounds
)
/client/verb/asf_toggle()
set name = "Open ASFX Tab"
set category = "Preferences"
set desc = "Open the ambiance sound effects toggle tab"
set desc = "Open the ambience sound effects toggle tab"
verbs ^= asfx_togs
return
@@ -99,4 +100,16 @@
if(prefs.asfx_togs & ASFX_RADIO)
to_chat(src, "You will now hear radio sounds.")
else
to_chat(src, "<font color='red'>You will no longer hear radio sounds.</font>")
to_chat(src, "<font color='red'>You will no longer hear radio sounds.</font>")
/client/proc/Toggle_instrumentsounds()
set name = "Toggle Instrument SFX"
set category = "SoundFx Prefs"
set desc = "Toggles hearing noises made by instruments."
prefs.asfx_togs ^= ASFX_INSTRUMENT
prefs.save_preferences()
if(prefs.asfx_togs & ASFX_INSTRUMENT)
to_chat(src, "You will now hear instrument sounds.")
else
to_chat(src, "<font color='red'>You will no longer hear instrument sounds.</font>")
@@ -0,0 +1,6 @@
author: mikomyazaki
delete-after: True
changes:
- rscadd: "There is now a preference to toggle instrument sound effects under the ASFX menu."