Files
wwdpublic/Content.Server/_White/TTS/VoiceMaskSystem.TTS.cs
Spatison 3b0dadc0d4 [Fix] TTS (#139)
* Revert "[Fix] TTS (#137)"

This reverts commit c5bd6b70a2.

* Revert "[Fix] Исправление ТТСа (#136)"

This reverts commit 3759acb84e.

* Revert "[Port] TTS (#121)"

This reverts commit 0db8f3aaa4.

* new TTS

* new TTS

* new TTS

* new TTS

* fix
2024-12-06 08:49:32 +02:00

32 lines
984 B
C#

using Content.Server._White.TTS;
using Content.Shared._White.TTS;
namespace Content.Server.VoiceMask;
public partial class VoiceMaskSystem
{
// ReSharper disable once InconsistentNaming
private void InitializeTTS()
{
SubscribeLocalEvent<VoiceMaskComponent, TransformSpeakerVoiceEvent>(OnSpeakerVoiceTransform);
SubscribeLocalEvent<VoiceMaskComponent, VoiceMaskChangeVoiceMessage>(OnChangeVoice);
}
private void OnSpeakerVoiceTransform(EntityUid uid, VoiceMaskComponent component, TransformSpeakerVoiceEvent args)
{
args.VoiceId = component.VoiceId;
}
private void OnChangeVoice(Entity<VoiceMaskComponent> entity, ref VoiceMaskChangeVoiceMessage msg)
{
if (msg.Voice is { } id && !_proto.HasIndex<TTSVoicePrototype>(id))
return;
entity.Comp.VoiceId = msg.Voice;
_popupSystem.PopupEntity(Loc.GetString("voice-mask-voice-popup-success"), entity);
UpdateUI(entity);
}
}