Muzzles reduce emote sound (#34444)

* Muzzles reduce emote sound

* update based on review comments

* review comments
This commit is contained in:
themias
2025-06-05 19:45:55 -04:00
committed by GitHub
parent 7943dad603
commit eb85a8a1b0
4 changed files with 34 additions and 9 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Frozen;
using Content.Shared.Chat.Prototypes;
using Content.Shared.Speech;
using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
@@ -126,16 +127,16 @@ public partial class ChatSystem
/// Tries to find and play relevant emote sound in emote sounds collection.
/// </summary>
/// <returns>True if emote sound was played.</returns>
public bool TryPlayEmoteSound(EntityUid uid, EmoteSoundsPrototype? proto, EmotePrototype emote)
public bool TryPlayEmoteSound(EntityUid uid, EmoteSoundsPrototype? proto, EmotePrototype emote, AudioParams? audioParams = null)
{
return TryPlayEmoteSound(uid, proto, emote.ID);
return TryPlayEmoteSound(uid, proto, emote.ID, audioParams);
}
/// <summary>
/// Tries to find and play relevant emote sound in emote sounds collection.
/// </summary>
/// <returns>True if emote sound was played.</returns>
public bool TryPlayEmoteSound(EntityUid uid, EmoteSoundsPrototype? proto, string emoteId)
public bool TryPlayEmoteSound(EntityUid uid, EmoteSoundsPrototype? proto, string emoteId, AudioParams? audioParams = null)
{
if (proto == null)
return false;
@@ -149,8 +150,8 @@ public partial class ChatSystem
return false;
}
// if general params for all sounds set - use them
var param = proto.GeneralParams ?? sound.Params;
// optional override params > general params for all sounds in set > individual sound params
var param = audioParams ?? proto.GeneralParams ?? sound.Params;
_audio.PlayPvs(sound, uid, param);
return true;
}