mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-24 09:08:04 +03:00
* Revert "[Fix] TTS (#137)" This reverts commitc5bd6b70a2. * Revert "[Fix] Исправление ТТСа (#136)" This reverts commit3759acb84e. * Revert "[Port] TTS (#121)" This reverts commit0db8f3aaa4. * new TTS * new TTS * new TTS * new TTS * fix
32 lines
984 B
C#
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);
|
|
}
|
|
}
|