mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
31 lines
967 B
C#
31 lines
967 B
C#
using Content.Server.Corvax.TTS;
|
|
using Content.Shared.Corvax.TTS;
|
|
using Content.Shared.VoiceMask;
|
|
|
|
namespace Content.Server.VoiceMask;
|
|
|
|
public partial class VoiceMaskSystem
|
|
{
|
|
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);
|
|
}
|
|
}
|