mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* move-accents-to-shared * Update AccentSystem.cs * Update ListeningSystem.cs * aaaaaa * Update AccentSystem.cs * oh god * aaooao * // * review * fix * Update VocalSystem.cs
40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using Content.Shared.Speech.Components;
|
|
using Content.Shared.Chat;
|
|
using Content.Shared.Chat.Prototypes;
|
|
|
|
namespace Content.Shared.Speech.EntitySystems;
|
|
|
|
public sealed partial class MumbleAccentSystem : RelayAccentSystem<MumbleAccentComponent>
|
|
{
|
|
[Dependency] private SharedChatSystem _chat = default!;
|
|
[Dependency] private ReplacementAccentSystem _replacement = default!;
|
|
|
|
public override void Initialize()
|
|
{
|
|
base.Initialize();
|
|
|
|
SubscribeLocalEvent<MumbleAccentComponent, EmoteEvent>(OnEmote, before: [typeof(VocalSystem)]);
|
|
}
|
|
|
|
// TODO: This likely will not hold up with a relay system!
|
|
private void OnEmote(Entity<MumbleAccentComponent> ent, ref EmoteEvent args)
|
|
{
|
|
if (args.Handled || !args.Emote.Category.HasFlag(EmoteCategory.Vocal))
|
|
return;
|
|
|
|
if (TryComp<VocalComponent>(ent.Owner, out var vocalComp) && vocalComp.EmoteSounds is { } sounds)
|
|
{
|
|
// play a muffled version of the vocal emote
|
|
args.Handled = _chat.TryPlayEmoteSound(
|
|
ent.Owner,
|
|
ProtoMan.Index(sounds),
|
|
args.Emote,
|
|
ent.Comp.EmoteAudioParams);
|
|
}
|
|
}
|
|
|
|
public override string Accentuate(string message, Entity<MumbleAccentComponent>? ent = null)
|
|
{
|
|
return _replacement.ApplyReplacements(message, "mumble", ent?.Owner);
|
|
}
|
|
}
|