Fix voice mask TTS (#3064)

This commit is contained in:
faint
2025-04-05 07:36:30 +03:00
committed by GitHub
parent 6957355270
commit 511eb6e8c9
4 changed files with 26 additions and 18 deletions

View File

@@ -1,6 +1,5 @@
using System.Threading.Tasks;
using Content.Server.Chat.Systems;
using Content.Server.Players.RateLimiting;
using Content.Shared.Corvax.CCCVars;
using Content.Shared.Corvax.TTS;
using Content.Shared.GameTicking;
@@ -150,15 +149,3 @@ public sealed partial class TTSSystem : EntitySystem
return await _ttsManager.ConvertTextToSpeech(speaker, textSsml);
}
}
public sealed class TransformSpeakerVoiceEvent : EntityEventArgs
{
public EntityUid Sender;
public string VoiceId;
public TransformSpeakerVoiceEvent(EntityUid sender, string voiceId)
{
Sender = sender;
VoiceId = voiceId;
}
}

View File

@@ -1,5 +1,5 @@
using Content.Server.Corvax.TTS;
using Content.Shared.Corvax.TTS;
using Content.Shared.Corvax.TTS;
using Content.Shared.Inventory;
using Content.Shared.VoiceMask;
namespace Content.Server.VoiceMask;
@@ -8,13 +8,13 @@ public partial class VoiceMaskSystem
{
private void InitializeTTS()
{
SubscribeLocalEvent<VoiceMaskComponent, TransformSpeakerVoiceEvent>(OnSpeakerVoiceTransform);
SubscribeLocalEvent<VoiceMaskComponent, InventoryRelayedEvent<TransformSpeakerVoiceEvent>>(OnSpeakerVoiceTransform);
SubscribeLocalEvent<VoiceMaskComponent, VoiceMaskChangeVoiceMessage>(OnChangeVoice);
}
private void OnSpeakerVoiceTransform(EntityUid uid, VoiceMaskComponent component, TransformSpeakerVoiceEvent args)
private void OnSpeakerVoiceTransform(EntityUid uid, VoiceMaskComponent component, InventoryRelayedEvent<TransformSpeakerVoiceEvent> args)
{
args.VoiceId = component.VoiceId;
args.Args.VoiceId = component.VoiceId;
}
private void OnChangeVoice(Entity<VoiceMaskComponent> entity, ref VoiceMaskChangeVoiceMessage msg)

View File

@@ -0,0 +1,17 @@
using Content.Shared.Inventory;
namespace Content.Shared.Corvax.TTS;
public sealed class TransformSpeakerVoiceEvent : EntityEventArgs, IInventoryRelayEvent
{
public SlotFlags TargetSlots => SlotFlags.MASK;
public EntityUid Sender;
public string VoiceId;
public TransformSpeakerVoiceEvent(EntityUid sender, string voiceId)
{
Sender = sender;
VoiceId = voiceId;
}
}

View File

@@ -3,6 +3,7 @@ using Content.Shared.Chat;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Hypospray.Events;
using Content.Shared.Climbing.Events;
using Content.Shared.Corvax.TTS;
using Content.Shared.Damage;
using Content.Shared.Electrocution;
using Content.Shared.Explosion;
@@ -43,6 +44,9 @@ public partial class InventorySystem
SubscribeLocalEvent<InventoryComponent, SelfBeforeClimbEvent>(RelayInventoryEvent);
SubscribeLocalEvent<InventoryComponent, CoefficientQueryEvent>(RelayInventoryEvent);
// Corvax-TTS
SubscribeLocalEvent<InventoryComponent, TransformSpeakerVoiceEvent>(RelayInventoryEvent);
// by-ref events
SubscribeLocalEvent<InventoryComponent, GetExplosionResistanceEvent>(RefRelayInventoryEvent);
SubscribeLocalEvent<InventoryComponent, IsWeightlessEvent>(RefRelayInventoryEvent);