diff --git a/Content.Client/Players/PlayTimeTracking/PlayTimeTrackingManager.cs b/Content.Client/Players/PlayTimeTracking/PlayTimeTrackingManager.cs index 4a0e1f09f218b0..cc4dd7e6d65e8b 100644 --- a/Content.Client/Players/PlayTimeTracking/PlayTimeTrackingManager.cs +++ b/Content.Client/Players/PlayTimeTracking/PlayTimeTrackingManager.cs @@ -58,6 +58,9 @@ public bool IsAllowed(AntagPrototype antag, [NotNullWhen(false)] out string? rea { reason = null; + if (!_cfg.GetCVar(CCVars.GameRoleTimers)) + return true; + var player = _playerManager.LocalPlayer?.Session; if (player == null) return true; diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs index aa51f3d0af406c..e89eb84ba1aa3f 100644 --- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs +++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs @@ -478,23 +478,23 @@ public HumanoidProfileEditor(IClientPreferencesManager preferencesManager, IProt foreach (var antag in prototypeManager.EnumeratePrototypes().OrderBy(a => Loc.GetString(a.Name))) { - bool check = false; - if(playTime.IsAllowed(antag, out var reason)) + var selector = new AntagPreferenceSelector(antag); + + if (!playTime.IsAllowed(antag, out var reason)) { - check = true; + selector.LockRequirements(antag, reason); } - + if (!antag.SetPreference) { continue; } - var selector = new AntagPreferenceSelector(antag,check); selector.Preference = false; _antagList.AddChild(selector); _antagPreferences.Add(selector); - + selector.PreferenceChanged += preference => { @@ -1329,7 +1329,7 @@ private sealed class AntagPreferenceSelector : Control { public AntagPrototype Antag { get; } private readonly CheckBox _checkBox; - + public bool Preference { get => _checkBox.Pressed; @@ -1338,7 +1338,7 @@ public bool Preference public bool Locked = false; public event Action? PreferenceChanged; - public AntagPreferenceSelector(AntagPrototype antag, bool check) + public AntagPreferenceSelector(AntagPrototype antag) { Antag = antag; @@ -1359,11 +1359,15 @@ public AntagPreferenceSelector(AntagPrototype antag, bool check) _checkBox } }); - if (check == false) - { - Locked = true; - _checkBox.Disabled = true; - } + + } + + public void LockRequirements(AntagPrototype antag, string requirements) + { + Locked = true; + _checkBox.Disabled = true; + _checkBox.Text = Loc.GetString("antag-timer-locked", ("antag", Loc.GetString(antag.Name))); + _checkBox.ToolTip = requirements; } private void OnCheckBoxToggled(BaseButton.ButtonToggledEventArgs args) diff --git a/Resources/Locale/en-US/job/role-timers.ftl b/Resources/Locale/en-US/job/role-timers.ftl index c9ebb75ed605ec..70994ff709eff8 100644 --- a/Resources/Locale/en-US/job/role-timers.ftl +++ b/Resources/Locale/en-US/job/role-timers.ftl @@ -6,3 +6,4 @@ role-timer-role-insufficient = You require {TOSTRING($time, "0")} more minutes w role-timer-role-too-high = You require {TOSTRING($time, "0")} fewer minutes with {$job} to play this role. (Are you trying to play a trainee role?) role-timer-locked = Locked (hover for details) +antag-timer-locked = {$antag}. Locked (hover for details) diff --git a/Resources/Locale/ru-RU/job/role-timers.ftl b/Resources/Locale/ru-RU/job/role-timers.ftl index ff410a4bef1ed8..3611c623ec7cb5 100644 --- a/Resources/Locale/ru-RU/job/role-timers.ftl +++ b/Resources/Locale/ru-RU/job/role-timers.ftl @@ -5,3 +5,4 @@ role-timer-overall-too-high = Требуется на { TOSTRING($time, "0") } role-timer-role-insufficient = Требуется ещё { TOSTRING($time, "0") } минут игры в качестве { $job } для этой роли. role-timer-role-too-high = Требуется на { TOSTRING($time, "0") } меньше минут игры в качестве { $job } для этой роли. (Вы пытаетесь играть за роль для новичков?) role-timer-locked = Закрыто (наведите курсор для подробностей) +antag-timer-locked = { $antag }. Закрыт (наведите курсор для подробностей)