diff --git a/Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs b/Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs index acb5ac1d18..3dbcd30d80 100644 --- a/Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs +++ b/Content.Client/VoiceMask/VoiceMaskBoundUserInterface.cs @@ -1,6 +1,7 @@ +using Content.Shared._Sunrise.SunriseCCVars; using Content.Shared.VoiceMask; -using Robust.Client.GameObjects; using Robust.Client.UserInterface; +using Robust.Shared.Configuration; using Robust.Shared.Prototypes; namespace Content.Client.VoiceMask; @@ -23,6 +24,12 @@ public sealed class VoiceMaskBoundUserInterface : BoundUserInterface _window = this.CreateWindow(); _window.ReloadVerbs(_protomanager); _window.AddVerbs(); + // Sunrise-TTS-Start + if (IoCManager.Resolve().GetCVar(SunriseCCVars.TTSEnabled)) + { + _window.ReloadVoices(IoCManager.Resolve()); + } + // Sunrise-TTS-End _window.OnNameChange += OnNameSelected; _window.OnVerbChange += verb => SendMessage(new VoiceMaskChangeVerbMessage(verb)); diff --git a/Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs b/Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs index 7f67696fca..52fe0d641b 100644 --- a/Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs +++ b/Content.Client/VoiceMask/VoiceMaskNameChangeWindow.xaml.cs @@ -1,11 +1,9 @@ using System.Linq; using Content.Client.UserInterface.Controls; -using Content.Shared._Sunrise.SunriseCCVars; using Content.Shared._Sunrise.TTS; using Content.Shared.Speech; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface.XAML; -using Robust.Shared.Configuration; using Robust.Shared.Prototypes; namespace Content.Client.VoiceMask; @@ -70,7 +68,7 @@ public sealed partial class VoiceMaskNameChangeWindow : FancyWindow } // Sunrise-TTS-Start - private void ReloadVoices(IPrototypeManager proto) + public void ReloadVoices(IPrototypeManager proto) { VoiceSelector.OnItemSelected += args => { @@ -89,6 +87,9 @@ public sealed partial class VoiceMaskNameChangeWindow : FancyWindow VoiceSelector.AddItem(name); VoiceSelector.SetItemMetadata(i, _voices[i].ID); } + + if (_voices.Count > 0) + TTSContainer.Visible = true; } // Sunrise-TTS-End diff --git a/Content.Server/VoiceMask/VoiceMaskSystem.cs b/Content.Server/VoiceMask/VoiceMaskSystem.cs index ff54403153..1e048f641d 100644 --- a/Content.Server/VoiceMask/VoiceMaskSystem.cs +++ b/Content.Server/VoiceMask/VoiceMaskSystem.cs @@ -91,7 +91,7 @@ public sealed partial class VoiceMaskSystem : EntitySystem private void UpdateUI(Entity entity) { if (_uiSystem.HasUi(entity, VoiceMaskUIKey.Key)) - _uiSystem.SetUiState(entity.Owner, VoiceMaskUIKey.Key, new VoiceMaskBuiState(GetCurrentVoiceName(entity), entity.Comp.VoiceMaskSpeechVerb)); + _uiSystem.SetUiState(entity.Owner, VoiceMaskUIKey.Key, new VoiceMaskBuiState(GetCurrentVoiceName(entity), entity.Comp.VoiceId, entity.Comp.VoiceMaskSpeechVerb)); } #endregion diff --git a/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs b/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs index fadac494eb..5d8fb370a3 100644 --- a/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs +++ b/Content.Server/Voting/Managers/VoteManager.DefaultVotes.cs @@ -86,7 +86,7 @@ namespace Content.Server.Voting.Managers if (totalPlayers <= playerVoteMaximum || ghostVoterPercentage >= ghostVotePercentageRequirement) { - StartVote(initiator); + StartVote(initiator, false); } else { @@ -134,7 +134,7 @@ namespace Content.Server.Voting.Managers return eligibleCount; } - private void StartVote(ICommonSession? initiator) + private void StartVote(ICommonSession? initiator, bool displayVotes = true) { var alone = _playerManager.PlayerCount == 1 && initiator != null; var options = new VoteOptions @@ -149,7 +149,8 @@ namespace Content.Server.Voting.Managers Duration = alone ? TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteTimerAlone)) : TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteTimerRestart)), - InitiatorTimeout = TimeSpan.FromMinutes(5) + InitiatorTimeout = TimeSpan.FromMinutes(5), + DisplayVotes = displayVotes }; if (alone) @@ -223,7 +224,8 @@ namespace Content.Server.Voting.Managers Title = Loc.GetString("ui-vote-gamemode-title"), Duration = alone ? TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteTimerAlone)) - : TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteTimerPreset)) + : TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteTimerPreset)), + DisplayVotes = false // Sunrise-Edit }; if (alone) @@ -275,7 +277,8 @@ namespace Content.Server.Voting.Managers Title = Loc.GetString("ui-vote-map-title"), Duration = alone ? TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteTimerAlone)) - : TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteTimerMap)) + : TimeSpan.FromSeconds(_cfg.GetCVar(CCVars.VoteTimerMap)), + DisplayVotes = false // Sunrise-Edit }; if (alone) diff --git a/Content.Server/_Sunrise/TTS/VoiceMaskSystem.TTS.cs b/Content.Server/_Sunrise/TTS/VoiceMaskSystem.TTS.cs index b1d194cc18..9a3b155ba2 100644 --- a/Content.Server/_Sunrise/TTS/VoiceMaskSystem.TTS.cs +++ b/Content.Server/_Sunrise/TTS/VoiceMaskSystem.TTS.cs @@ -13,8 +13,7 @@ public partial class VoiceMaskSystem private void OnSpeakerVoiceTransform(EntityUid uid, VoiceMaskComponent component, TransformSpeakerVoiceEvent args) { - if (component.Enabled) - args.VoiceId = component.VoiceId; + args.VoiceId = component.VoiceId; } private void OnChangeVoice(EntityUid uid, VoiceMaskComponent component, VoiceMaskChangeVoiceMessage message) @@ -25,18 +24,16 @@ public partial class VoiceMaskSystem TrySetLastKnownVoice(uid, message.Voice); - UpdateUI(uid, component); + UpdateUI((uid, component)); } - private void TrySetLastKnownVoice(EntityUid maskWearer, string? voiceId) + private void TrySetLastKnownVoice(EntityUid maskWearer, string voiceId) { - if (!HasComp(maskWearer) - || !_inventory.TryGetSlotEntity(maskWearer, MaskSlot, out var maskEntity) - || !TryComp(maskEntity, out var maskComp)) + if (!TryComp(maskWearer, out var maskComp)) { return; } - maskComp.LastSetVoice = voiceId; + maskComp.VoiceId = voiceId; } }