TTS fix t1

This commit is contained in:
Dmitry 2026-07-02 12:50:30 +07:00
parent 454b818ea3
commit 9ca71ff554
11 changed files with 30 additions and 30 deletions

View file

@ -225,6 +225,7 @@ public sealed partial class HumanoidProfileEditor
RefreshLoadouts();
UpdateSexControls(); // update sex for new species
UpdateVoiceControls();
UpdateTTSVoicesControls(); // Corvax-TTS
UpdateSpeciesGuidebookIcon();
ReloadPreview();
}

View file

@ -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)

View file

@ -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,

View file

@ -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!;

View file

@ -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();

View file

@ -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,

View file

@ -37,7 +37,7 @@ public sealed partial class HumanoidProfileComponent : Component
public ProtoId<SpeciesPrototype> Species = HumanoidCharacterProfile.DefaultSpecies;
// Corvax-TTS-Start
[DataField("voice")]
public ProtoId<TTSVoicePrototype> Voice { get; set; } = HumanoidProfileSystem.DefaultVoice;
[DataField, AutoNetworkedField]
public ProtoId<TTSVoicePrototype> TTSVoice { get; set; } = HumanoidProfileSystem.DefaultVoice;
// Corvax-TTS-End
}

View file

@ -63,7 +63,7 @@ public sealed partial class HumanoidCharacterProfileV1
public ProtoId<SpeciesPrototype> 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.

View file

@ -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<TTSComponent>(ent, out var _TTSComponent) && _TTSComponent.VoicePrototypeId == "Taskmaster")
{
_TTSComponent.VoicePrototypeId = profile.Voice;
_TTSComponent.VoicePrototypeId = profile.TTSVoice;
}
// Corvax-TTS-end
Dirty(ent);

View file

@ -87,7 +87,7 @@ namespace Content.Shared.Preferences
public ProtoId<SpeciesPrototype> 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<EmoteSoundsPrototype> 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<TTSVoicePrototype>(Voice, out var voice);
if (voice is null || !CanHaveVoice(voice, Sex))
Voice = HumanoidProfileSystem.DefaultSexVoice[sex];
prototypeManager.TryIndex<TTSVoicePrototype>(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.

View file

@ -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;
/// <summary>
/// Fired when a voice mask is turned on.
/// </summary>
/// <param name=="Mask">The voice mask that was turned on</param>
/// <param name=="Source">The entity that owns the voice mask</param>
/// <param name=="Active">The new value of the voice mask</param>
/// <param name=="Mask">The voice mask that was turned on</param>
/// <param name=="Source">The entity that owns the voice mask</param>
/// <param name=="Active">The new value of the voice mask</param>
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;