From 9ca71ff55416702afbfaf08afdd593438d2bd20c Mon Sep 17 00:00:00 2001 From: Dmitry <57028746+DIMMoon1@users.noreply.github.com> Date: Thu, 2 Jul 2026 12:50:30 +0700 Subject: [PATCH] TTS fix t1 --- .../UI/HumanoidProfileEditor.Appearance.cs | 1 + .../VoiceMask/VoiceMaskBoundUserInterface.cs | 2 +- .../Tests/Preferences/ServerDbSqliteTests.cs | 2 +- Content.Server.Database/Model.cs | 2 +- Content.Server/Database/ServerDbBase.cs | 2 +- .../Managers/ServerPreferencesManager.cs | 8 ++++---- .../Humanoid/HumanoidProfileComponent.cs | 4 ++-- .../Humanoid/HumanoidProfileExportV1.cs | 5 ++--- .../Humanoid/HumanoidProfileSystem.cs | 4 ++-- .../Preferences/HumanoidCharacterProfile.cs | 18 +++++++++--------- .../VoiceMask/SharedVoiceMaskSystem.cs | 12 ++++++------ 11 files changed, 30 insertions(+), 30 deletions(-) diff --git a/Content.Client/Lobby/UI/HumanoidProfileEditor.Appearance.cs b/Content.Client/Lobby/UI/HumanoidProfileEditor.Appearance.cs index 7f6beb9acf..5eaa0f389c 100644 --- a/Content.Client/Lobby/UI/HumanoidProfileEditor.Appearance.cs +++ b/Content.Client/Lobby/UI/HumanoidProfileEditor.Appearance.cs @@ -225,6 +225,7 @@ public sealed partial class HumanoidProfileEditor RefreshLoadouts(); UpdateSexControls(); // update sex for new species UpdateVoiceControls(); + UpdateTTSVoicesControls(); // Corvax-TTS UpdateSpeciesGuidebookIcon(); ReloadPreview(); } diff --git a/Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs b/Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs index c1fa7d0991..49da183417 100644 --- a/Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs +++ b/Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs @@ -53,7 +53,7 @@ public sealed partial class VoiceMaskBoundUserInterface : BoundUserInterface return; } - _window.UpdateState(cast.Name, cast.Verb, cast.Active, cast.AccentHide, cast.TitleText, cast.Voice);//cast.Voice Corvax-TTS + _window.UpdateState(cast.Name, cast.Verb, cast.Active, cast.AccentHide, cast.TitleText, cast.TTSVoice);//cast.Voice Corvax-TTS } protected override void Dispose(bool disposing) diff --git a/Content.IntegrationTests/Tests/Preferences/ServerDbSqliteTests.cs b/Content.IntegrationTests/Tests/Preferences/ServerDbSqliteTests.cs index b62f5627db..89469b5f40 100644 --- a/Content.IntegrationTests/Tests/Preferences/ServerDbSqliteTests.cs +++ b/Content.IntegrationTests/Tests/Preferences/ServerDbSqliteTests.cs @@ -52,7 +52,7 @@ namespace Content.IntegrationTests.Tests.Preferences Name = "Charlie Charlieson", FlavorText = "The biggest boy around.", Species = "Human", - Voice = "Eugene", // Corvax-TTS + TTSVoice = "Eugene", // Corvax-TTS Age = 21, Appearance = new( Color.Azure, diff --git a/Content.Server.Database/Model.cs b/Content.Server.Database/Model.cs index 0f5d8ede06..bd0ddf39ab 100644 --- a/Content.Server.Database/Model.cs +++ b/Content.Server.Database/Model.cs @@ -335,7 +335,7 @@ namespace Content.Server.Database public string? Voice { get; set; } = null!; // If null, the voice gets defaulted to the sex associated value public string Gender { get; set; } = null!; public string Species { get; set; } = null!; - public string Voice { get; set; } = null!; // Corvax-TTS + public string TTSVoice { get; set; } = null!; // Corvax-TTS [Column(TypeName = "jsonb")] public JsonDocument? OrganMarkings { get; set; } = null!; [Column(TypeName = "jsonb")] public JsonDocument? Markings { get; set; } = null!; public string HairName { get; set; } = null!; diff --git a/Content.Server/Database/ServerDbBase.cs b/Content.Server/Database/ServerDbBase.cs index 4cd3a287e4..9c93cd79fc 100644 --- a/Content.Server/Database/ServerDbBase.cs +++ b/Content.Server/Database/ServerDbBase.cs @@ -212,7 +212,7 @@ namespace Content.Server.Database profile.CharacterName = humanoid.Name; profile.FlavorText = humanoid.FlavorText; profile.Species = humanoid.Species; - profile.Voice = humanoid.Voice; // Corvax-TTS + profile.TTSVoice = humanoid.TTSVoice; // Corvax-TTS profile.Age = humanoid.Age; profile.Sex = humanoid.Sex.ToString(); profile.Voice = humanoid.Voice.ToString(); diff --git a/Content.Server/Preferences/Managers/ServerPreferencesManager.cs b/Content.Server/Preferences/Managers/ServerPreferencesManager.cs index 388fbf0505..432e0c50b0 100644 --- a/Content.Server/Preferences/Managers/ServerPreferencesManager.cs +++ b/Content.Server/Preferences/Managers/ServerPreferencesManager.cs @@ -111,9 +111,9 @@ namespace Content.Server.Preferences.Managers gender = genderVal; // Corvax-TTS-Start - var voice = profile.Voice; - if (voice == String.Empty) - voice = HumanoidProfileSystem.DefaultSexVoice[sex]; + var TTSVoice = profile.TTSVoice; + if (TTSVoice == String.Empty) + TTSVoice = HumanoidProfileSystem.DefaultSexVoice[sex]; // Corvax-TTS-End var markings = @@ -188,7 +188,7 @@ namespace Content.Server.Preferences.Managers profile.CharacterName, profile.FlavorText, species, - voice, // Corvax-TTS + TTSVoice, // Corvax-TTS profile.Age, sex, voice, diff --git a/Content.Shared/Humanoid/HumanoidProfileComponent.cs b/Content.Shared/Humanoid/HumanoidProfileComponent.cs index 2805a1a6e5..00cf56f22d 100644 --- a/Content.Shared/Humanoid/HumanoidProfileComponent.cs +++ b/Content.Shared/Humanoid/HumanoidProfileComponent.cs @@ -37,7 +37,7 @@ public sealed partial class HumanoidProfileComponent : Component public ProtoId Species = HumanoidCharacterProfile.DefaultSpecies; // Corvax-TTS-Start - [DataField("voice")] - public ProtoId Voice { get; set; } = HumanoidProfileSystem.DefaultVoice; + [DataField, AutoNetworkedField] + public ProtoId TTSVoice { get; set; } = HumanoidProfileSystem.DefaultVoice; // Corvax-TTS-End } diff --git a/Content.Shared/Humanoid/HumanoidProfileExportV1.cs b/Content.Shared/Humanoid/HumanoidProfileExportV1.cs index de72f18404..c28849c801 100644 --- a/Content.Shared/Humanoid/HumanoidProfileExportV1.cs +++ b/Content.Shared/Humanoid/HumanoidProfileExportV1.cs @@ -63,7 +63,7 @@ public sealed partial class HumanoidCharacterProfileV1 public ProtoId Species; [DataField] //Corvax-TTS - public string Voice = HumanoidProfileSystem.DefaultVoice; + public string TTSVoice = HumanoidProfileSystem.DefaultVoice; [DataField] public int Age; @@ -85,8 +85,7 @@ public sealed partial class HumanoidCharacterProfileV1 public HumanoidCharacterProfile ToV2() { - return new(Name, FlavorText, Species, Age, Sex, GetDefaultVoice(Species, Sex), Gender, Appearance.ToV2(Species), SpawnPriority, JobPriorities, PreferenceUnavailable, AntagPreferences, TraitPreferences, Loadouts); - return new(Name, FlavorText, Species, Voice, Age, Sex, Gender, Appearance.ToV2(Species), SpawnPriority, JobPriorities, PreferenceUnavailable, AntagPreferences, TraitPreferences, Loadouts); + return new(Name, FlavorText, Species, TTSVoice, Age, Sex, GetDefaultVoice(Species, Sex), Gender, Appearance.ToV2(Species), SpawnPriority, JobPriorities, PreferenceUnavailable, AntagPreferences, TraitPreferences, Loadouts); } // In V2 voices are stored as a separate database entry, this picks the default for the species and sex, which would give the same voice as pre-nubody. diff --git a/Content.Shared/Humanoid/HumanoidProfileSystem.cs b/Content.Shared/Humanoid/HumanoidProfileSystem.cs index c9dd44ae8b..fa788b2a34 100644 --- a/Content.Shared/Humanoid/HumanoidProfileSystem.cs +++ b/Content.Shared/Humanoid/HumanoidProfileSystem.cs @@ -40,10 +40,10 @@ public sealed partial class HumanoidProfileSystem : EntitySystem ent.Comp.Voice = profile.Voice; ent.Comp.Sex = profile.Sex; // Corvax-TTS-start - ent.Comp.Voice = profile.Voice; + ent.Comp.TTSVoice = profile.TTSVoice; if (TryComp(ent, out var _TTSComponent) && _TTSComponent.VoicePrototypeId == "Taskmaster") { - _TTSComponent.VoicePrototypeId = profile.Voice; + _TTSComponent.VoicePrototypeId = profile.TTSVoice; } // Corvax-TTS-end Dirty(ent); diff --git a/Content.Shared/Preferences/HumanoidCharacterProfile.cs b/Content.Shared/Preferences/HumanoidCharacterProfile.cs index f4b1009294..cfee781541 100644 --- a/Content.Shared/Preferences/HumanoidCharacterProfile.cs +++ b/Content.Shared/Preferences/HumanoidCharacterProfile.cs @@ -87,7 +87,7 @@ namespace Content.Shared.Preferences public ProtoId Species { get; set; } = DefaultSpecies; [DataField] //Corvax-TTS - public string Voice { get; set; } = HumanoidProfileSystem.DefaultVoice; + public string TTSVoice { get; set; } = HumanoidProfileSystem.DefaultVoice; [DataField] public int Age { get; set; } = 18; @@ -139,7 +139,7 @@ namespace Content.Shared.Preferences string name, string flavortext, string species, - string voice, // Corvax-TTS + string TTS_voice, // Corvax-TTS int age, Sex sex, ProtoId voice, @@ -155,7 +155,7 @@ namespace Content.Shared.Preferences Name = name; FlavorText = flavortext; Species = species; - Voice = voice; // Corvax-TTS + TTSVoice = TTS_voice; // Corvax-TTS Age = age; Sex = sex; Voice = voice; @@ -188,7 +188,7 @@ namespace Content.Shared.Preferences : this(other.Name, other.FlavorText, other.Species, - other.Voice, + other.TTSVoice, other.Age, other.Sex, other.Voice, @@ -292,7 +292,7 @@ namespace Content.Shared.Preferences Age = age, Gender = gender, Species = species, - Voice = voiceId, // Corvax-TTS + TTSVoice = voiceId, // Corvax-TTS Appearance = HumanoidCharacterAppearance.Random(species, sex), }; } @@ -335,7 +335,7 @@ namespace Content.Shared.Preferences // Corvax-TTS-Start public HumanoidCharacterProfile WithVoice(string voice) { - return new(this) { Voice = voice }; + return new(this) { TTSVoice = voice }; } // Corvax-TTS-End @@ -678,9 +678,9 @@ namespace Content.Shared.Preferences _traitPreferences.UnionWith(GetValidTraits(traits, prototypeManager)); // Corvax-TTS-Start - prototypeManager.TryIndex(Voice, out var voice); - if (voice is null || !CanHaveVoice(voice, Sex)) - Voice = HumanoidProfileSystem.DefaultSexVoice[sex]; + prototypeManager.TryIndex(Voice, out var TTS_voice); + if (TTS_voice is null || !CanHaveVoice(TTS_voice, Sex)) + TTSVoice = HumanoidProfileSystem.DefaultSexVoice[sex]; // Corvax-TTS-End // Checks prototypes exist for all loadouts and dump / set to default if not. diff --git a/Content.Shared/VoiceMask/SharedVoiceMaskSystem.cs b/Content.Shared/VoiceMask/SharedVoiceMaskSystem.cs index a313fecadb..aa17eb984b 100644 --- a/Content.Shared/VoiceMask/SharedVoiceMaskSystem.cs +++ b/Content.Shared/VoiceMask/SharedVoiceMaskSystem.cs @@ -17,7 +17,7 @@ public sealed class VoiceMaskBuiState : BoundUserInterfaceState public readonly bool Active; public readonly bool AccentHide; public readonly LocId TitleText; - public readonly string Voice; // Corvax-TTS + public readonly string TTSVoice; // Corvax-TTS public VoiceMaskBuiState(string name, string? verb, bool active, bool accentHide, LocId titleText, string voice) // Corvax-TTS { @@ -26,7 +26,7 @@ public sealed class VoiceMaskBuiState : BoundUserInterfaceState Active = active; AccentHide = accentHide; TitleText = titleText; - Voice = voice; // Corvax-TTS + TTSVoice = voice; // Corvax-TTS } } @@ -70,14 +70,14 @@ public sealed class VoiceMaskAccentToggleMessage : BoundUserInterfaceMessage; /// /// Fired when a voice mask is turned on. /// -/// The voice mask that was turned on -/// The entity that owns the voice mask -/// The new value of the voice mask +/// The voice mask that was turned on +/// The entity that owns the voice mask +/// The new value of the voice mask public sealed class VoiceMaskToggledEvent(EntityUid mask, EntityUid source, bool active) : IInventoryRelayEvent { public EntityUid Mask = mask; public EntityUid Source = source; - + public bool Active = active; SlotFlags IInventoryRelayEvent.TargetSlots => SlotFlags.WITHOUT_POCKET;