Synthetic Emotes Fix (#6125)

* separate synthetic emote

* fix duplicate IDs (server error)

* Update speech_emotes.yml

* maybe this

* maybe keep the removed things from upstream lol

* imagine yamlops-ing when the problem was your trash code all along
This commit is contained in:
wesker 2026-06-27 01:23:37 +08:00 committed by GitHub
parent d3b13a6c83
commit 3001253e43
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 18 additions and 16 deletions

View File

@ -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<SynthComponent, ComponentStartup>(OnStartup);
SubscribeLocalEvent<SynthComponent, EmoteEvent>(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<VocalComponent>(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
}