Synth emote fix (#6136)

* testing

* Actually fix synth emotes.

* Fixed harpies playing the emote sound twice.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Vanessa 2026-07-02 12:10:34 -05:00 committed by GitHub
parent 4898707628
commit d6023d58f5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 22 additions and 21 deletions

View File

@ -5,7 +5,9 @@ using Content.Shared.Chat;
using Content.Shared.Chat.Prototypes;
using Content.Shared.Chat.TypingIndicator;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Speech;
using Content.Shared.Speech.Components;
using Content.Shared.Speech.EntitySystems;
using Content.Shared.Tag;
using Robust.Shared.Prototypes;
@ -16,22 +18,22 @@ public sealed class SynthSystem : EntitySystem
// Begin DeltaV - make strings static readonly
private static readonly ProtoId<TypingIndicatorPrototype> RobotTypingIndicator = "robot";
private static readonly ProtoId<ReagentPrototype> SynthBloodReagent = "SynthBlood";
private static readonly ProtoId<TagPrototype> SyntheticEmotesTag = "SyntheticEmotes";
private static readonly ProtoId<TagPrototype> SyntheticEmotesTag = "SiliconEmotes";
private static readonly ProtoId<EmoteSoundsPrototype> SyntheticEmoteSounds = "SyntheticEmoteSounds";
private static readonly ProtoId<EmotePrototype>[] SiliconEmotes = ["Beep", "Chime", "Buzz", "Buzz-Two", "Ping"];
// End DeltaV
[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
SubscribeLocalEvent<SynthComponent, EmoteEvent>(OnEmote);
}
private void OnStartup(EntityUid uid, SynthComponent component, ComponentStartup args)
@ -42,26 +44,30 @@ public sealed class SynthSystem : EntitySystem
Dirty(uid, indicator);
}
// Begin DeltaV - Change blood amount according to original BloodstreamCompoent.ReferenceSolution volume
if (TryComp<BloodstreamComponent>(uid, out var bloodstream))
{
// Give them synth blood. Ion storm notif is handled in that system
_bloodstream.ChangeBloodReagents((uid, bloodstream), new([new(SynthBloodReagent, bloodstream.BloodReferenceSolution.Volume)]));
}
// End DeltaV
_tag.AddTag(uid, SyntheticEmotesTag); // delta-v - proper synthe emote implementation
// Add the silicon emotes to the allow list so we can ignore the emote whitelist/blacklist. This just allows the emote event to
// be sent but it does not associate a sound with the emote. We'll intercept that event in OnEmote and play the sound manually there
// since we cannot add just add sounds on the fly to the emote sounds of a species (everyone will have a different sound).
if (HasComp<VocalComponent>(uid) && TryComp<SpeechComponent>(uid, out var speech))
{
speech.AllowedEmotes.AddRange(SiliconEmotes);
Dirty(uid, speech);
}
}
// 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);
// If we make it this far, its an allowed emote, so just resolve the sound from
// the SyntheticEmoteSounds prototype and play it.
if (_proto.Resolve(SyntheticEmoteSounds, out var emoteSound))
args.Handled = _chat.TryPlayEmoteSound(uid, emoteSound, args.Emote);
}
// End DeltaV
}

View File

@ -344,12 +344,11 @@
category: Vocal
icon: Interface/Emotes/buzz.png
whitelist:
# requireAll: true # Delta-V change - makes the whitelist become an any check instead of requiring everything.
requireAll: true
components:
- Vocal
tags:
- SiliconEmotes
- SyntheticEmotes # Delta-V change - added machine emotes for the synthetic trait.
chatMessages: ["chat-emote-msg-buzz"]
chatTriggers:
- buzzing
@ -433,12 +432,11 @@
category: Vocal
icon: Interface/Emotes/beep.png
whitelist:
# requireAll: true # Delta-V change - makes the whitelist become an any check instead of requiring everything.
requireAll: true
components:
- Vocal
tags:
- SiliconEmotes
- SyntheticEmotes # Delta-V change - added machine emotes for the synthetic trait.
chatMessages: ["chat-emote-msg-beep"]
chatTriggers:
- beep
@ -452,12 +450,11 @@
category: Vocal
icon: Interface/Emotes/chime.png
whitelist:
# requireAll: true # Delta-V change - makes the whitelist become an any check instead of requiring everything.
requireAll: true
components:
- Vocal
tags:
- SiliconEmotes
- SyntheticEmotes # Delta-V change - added machine emotes for the synthetic trait.
chatMessages: ["chat-emote-msg-chime"]
chatTriggers:
- chime
@ -471,12 +468,11 @@
category: Vocal
icon: Interface/Emotes/buzztwo.png
whitelist:
# requireAll: true # Delta-V change - makes the whitelist become an any check instead of requiring everything.
requireAll: true
components:
- Vocal
tags:
- SiliconEmotes
- SyntheticEmotes # Delta-V change - added machine emotes for the synthetic trait.
chatMessages: ["chat-emote-msg-buzzestwo"]
chatTriggers:
- buzztwice
@ -496,12 +492,11 @@
category: Vocal
icon: Interface/Emotes/ping.png
whitelist:
# requireAll: true # Delta-V change - makes the whitelist become an any check instead of requiring everything.
requireAll: true
components:
- Vocal
tags:
- SiliconEmotes
- SyntheticEmotes # Delta-V change - added machine emotes for the synthetic trait.
chatMessages: ["chat-emote-msg-ping"]
chatTriggers:
- ping