diff --git a/Content.Server/_CD/Traits/SynthSystem.cs b/Content.Server/_CD/Traits/SynthSystem.cs index f3ce5a16339..14f1da3d52b 100644 --- a/Content.Server/_CD/Traits/SynthSystem.cs +++ b/Content.Server/_CD/Traits/SynthSystem.cs @@ -1,6 +1,7 @@ using Content.Server.Body.Systems; -using Content.Server.Database; +using Content.Server.Chat.Systems; using Content.Shared.Body.Components; +using Content.Shared.Chat; using Content.Shared.Chat.Prototypes; using Content.Shared.Chat.TypingIndicator; using Content.Shared.Chemistry.Reagent; @@ -22,12 +23,15 @@ public sealed class SynthSystem : EntitySystem [Dependency] private readonly BloodstreamSystem _bloodstream = default!; [Dependency] private readonly TagSystem _tag = default!; [Dependency] private readonly IPrototypeManager _proto = default!; + [Dependency] private readonly ChatSystem _chat = default!; + private EmoteSoundsPrototype? _syntheticEmoteSounds; // delta-v - proper synthe emote implementation public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnStartup); + SubscribeLocalEvent(OnEmote); // delta-v - proper synthe emote implementation } private void OnStartup(EntityUid uid, SynthComponent component, ComponentStartup args) @@ -46,20 +50,18 @@ public sealed class SynthSystem : EntitySystem } // End DeltaV - // Begin DeltaV - Add SyntheticEmotes tag and merge synthetic emote sounds into species sounds - _tag.AddTag(uid, SyntheticEmotesTag); - - if (TryComp(uid, out var vocal) - && _proto.TryIndex(SyntheticEmoteSounds, out var synthSounds) - && vocal.EmoteSounds is { } currentSoundsId - && _proto.TryIndex(currentSoundsId, out var currentSounds)) - { - foreach (var (emoteId, sound) in synthSounds.Sounds) - { - currentSounds.Sounds.TryAdd(emoteId, sound); - } - Dirty(uid, vocal); - } - // End DeltaV + _tag.AddTag(uid, SyntheticEmotesTag); // delta-v - proper synthe emote implementation } + + // Start DeltaV - proper synthe emote implementation + private void OnEmote(EntityUid uid, SynthComponent component, ref EmoteEvent args) + { + if (args.Handled) + return; + + _syntheticEmoteSounds ??= _proto.Index(SyntheticEmoteSounds); + + args.Handled = _chat.TryPlayEmoteSound(uid, _syntheticEmoteSounds, args.Emote); + } + // End DeltaV } \ No newline at end of file