From c4921dfdf73e1da9e1462d1f1f9c3a3bfdecc6c1 Mon Sep 17 00:00:00 2001 From: Rykka Stormheart Date: Tue, 28 Mar 2023 21:01:49 -0700 Subject: [PATCH] Species Sounds Hotfix 2 Gives Cough/Sneeze/Gasp back default sounds if they lack one in their species list. Fixes death sound doubling up. Fixes runtime in sounds - it will now simply return null rather than trying to index the list and failing. --- code/game/sound.dm | 4 +++- code/modules/emotes/definitions/audible_cough.dm | 8 +++++++- .../modules/emotes/definitions/audible_sneeze.dm | 8 +++++++- code/modules/mob/living/death.dm | 3 ++- .../code/modules/emotes/definitions/audiable.dm | 8 +++++++- modular_chomp/sound/voice/silence.ogg | Bin 0 -> 2662 bytes 6 files changed, 26 insertions(+), 5 deletions(-) create mode 100644 modular_chomp/sound/voice/silence.ogg diff --git a/code/game/sound.dm b/code/game/sound.dm index db2ee47365..3b37f0c8eb 100644 --- a/code/game/sound.dm +++ b/code/game/sound.dm @@ -402,7 +402,9 @@ var/list/species_sound_map = list( * get_species_sound(H.species.species_sounds_male)["emote"] // If we're male, and want an emote sound gendered correctly. */ /proc/get_species_sound(var/sounds) - return species_sound_map[sounds] + if(!islist(species_sound_map[sounds])) // We check here if this list actually has anything in it, or if we're about to return a null index + return null // Shitty failsafe but better than rewriting an entire litany of procs rn when I'm low on time - Rykka // list('modular_chomp/sound/voice/silence.ogg') + return species_sound_map[sounds] // Otherwise, successfully return our sound /* * The following helper proc will select a species' default sounds - useful for if we're set to "Unset" diff --git a/code/modules/emotes/definitions/audible_cough.dm b/code/modules/emotes/definitions/audible_cough.dm index e30b0be3fd..45323390eb 100644 --- a/code/modules/emotes/definitions/audible_cough.dm +++ b/code/modules/emotes/definitions/audible_cough.dm @@ -19,8 +19,14 @@ if(ishuman(user) && !check_synthetic(user)) var/mob/living/carbon/human/H = user var/vol = H.species.cough_volume + var/s = get_species_sound(get_gendered_sound(H))["cough"] + if(!s && !(get_species_sound(H.species.species_sounds) == "None")) // Failsafe, so we always use the default cough/etc sounds. None will cancel out anyways. + if(H.identifying_gender == FEMALE) + s = get_species_sound("Human Female")["cough"] + else // Update this if we ever get herm/etc sounds. + s = get_species_sound("Human Male")["cough"] return list( - "sound" = get_species_sound(get_gendered_sound(H))["cough"], + "sound" = s, "vol" = vol, "volchannel" = VOLUME_CHANNEL_SPECIES_SOUNDS ) diff --git a/code/modules/emotes/definitions/audible_sneeze.dm b/code/modules/emotes/definitions/audible_sneeze.dm index 3d745fa1b7..b3a0a2ba16 100644 --- a/code/modules/emotes/definitions/audible_sneeze.dm +++ b/code/modules/emotes/definitions/audible_sneeze.dm @@ -12,8 +12,14 @@ var/mob/living/carbon/human/H = user // CHOMPEdit Start: Standardize Species Sounds var/vol = H.species.sneeze_volume + var/s = get_species_sound(get_gendered_sound(H))["sneeze"] + if(!s && !(get_species_sound(H.species.species_sounds) == "None")) // Failsafe, so we always use the default sneeze/etc sounds. None will cancel out anyways. + if(H.identifying_gender == FEMALE) + s = get_species_sound("Human Female")["sneeze"] + else // Update this if we ever get herm/etc sounds. + s = get_species_sound("Human Male")["sneeze"] return list( - "sound" = get_species_sound(get_gendered_sound(H))["sneeze"], + "sound" = s, "vol" = vol, "exr" = 20, "volchannel" = VOLUME_CHANNEL_SPECIES_SOUNDS diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index 722062803c..90c0b8f42b 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -31,7 +31,8 @@ if(src.death_sound_override) // Do we override the death sounds from our species list - used by only a few specific mobs. If we do, do the next one instead playsound(src, death_sound_override, 50, 1, 20, volume_channel = VOLUME_CHANNEL_SPECIES_SOUNDS) else - playsound(src, pick(get_species_sound(get_gendered_sound(src))["death"]), 50, 1, 20, volume_channel = VOLUME_CHANNEL_SPECIES_SOUNDS) + if(!ishuman(src)) // Safety, we're not going to double up on death noises if we're not human. + playsound(src, pick(get_species_sound(get_gendered_sound(src))["death"]), 50, 1, 20, volume_channel = VOLUME_CHANNEL_SPECIES_SOUNDS) // CHOMPStation Add End . = ..() diff --git a/modular_chomp/code/modules/emotes/definitions/audiable.dm b/modular_chomp/code/modules/emotes/definitions/audiable.dm index b01c5c2f37..72273a8664 100644 --- a/modular_chomp/code/modules/emotes/definitions/audiable.dm +++ b/modular_chomp/code/modules/emotes/definitions/audiable.dm @@ -14,8 +14,14 @@ var/mob/living/carbon/human/H = user // CHOMPEdit: Standardize Species Sounds Getters var/vol = H.species.gasp_volume + var/s = get_species_sound(get_gendered_sound(H))["gasp"] + if(!s && !(get_species_sound(H.species.species_sounds) == "None")) // Failsafe, so we always use the default gasp/etc sounds. None will cancel out anyways. + if(H.identifying_gender == FEMALE) + s = get_species_sound("Human Female")["gasp"] + else // Update this if we ever get herm/etc sounds. + s = get_species_sound("Human Male")["gasp"] return list( - "sound" = get_species_sound(get_gendered_sound(H))["gasp"], + "sound" = s, "vol" = vol, "volchannel" = VOLUME_CHANNEL_SPECIES_SOUNDS ) diff --git a/modular_chomp/sound/voice/silence.ogg b/modular_chomp/sound/voice/silence.ogg new file mode 100644 index 0000000000000000000000000000000000000000..41ee44cd04b0eb806b75e72ed7a88c02ffdcd100 GIT binary patch literal 2662 zcmcIme@qiu9)CrY0+m#*vK4XDs$Dx^U51rg%jFWN;?gN9PDRT!=5AYhTH2yg@S=O< zI4S6|UAK$VF7Bb>N2jrc=}MP&W8LFCwN)!=xJrvBy6WWwq`0@2%f?H*WbaL3O)j~A z?s zVRpVA%uW{M4*s@4lKnGgRciQ`E$S$OkV=2_@RmJIhXh8wW`9bvKrSdLMoWrIir*24 z_m~>>N1JqJU1KxCsAVl*+?p%fz8`940S?X+iq9C!Jb093cI}uS0R<_l+{YP9d|%V%Trbfl?hbWZ{{gF<(VSmE^l+5V(z@wf$m(V zjS|=eZ32bsa9rMR=9m3SRL?8h8Jg4lrnt;LAQO+>`UZb4>F82-{b4F!nUq-g3jLqh z@0(xv;}5Zh5MOIW!=b+_#iu50wJ9f*r?XNvX8~}%hEut>jRDG6fHuIZJjT0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