diff --git a/Content.Client/Administration/UI/Tabs/ServerTab.xaml b/Content.Client/Administration/UI/Tabs/ServerTab.xaml index 4691a9da9f..57a87dcb83 100644 --- a/Content.Client/Administration/UI/Tabs/ServerTab.xaml +++ b/Content.Client/Administration/UI/Tabs/ServerTab.xaml @@ -7,7 +7,7 @@ Columns="4" > - - + + diff --git a/Content.Client/Administration/UI/Tabs/ServerTab.xaml.cs b/Content.Client/Administration/UI/Tabs/ServerTab.xaml.cs index e76b390aae..24b92e42ce 100644 --- a/Content.Client/Administration/UI/Tabs/ServerTab.xaml.cs +++ b/Content.Client/Administration/UI/Tabs/ServerTab.xaml.cs @@ -1,10 +1,44 @@ -using Robust.Client.AutoGenerated; +using Content.Shared.CCVar; +using Robust.Client.AutoGenerated; using Robust.Client.UserInterface; +using Robust.Client.UserInterface.XAML; +using Robust.Shared.Configuration; namespace Content.Client.Administration.UI.Tabs { [GenerateTypedNameReferences] public sealed partial class ServerTab : Control { + [Dependency] private readonly IConfigurationManager _config = default!; + + public ServerTab() + { + RobustXamlLoader.Load(this); + IoCManager.InjectDependencies(this); + + _config.OnValueChanged(CCVars.OocEnabled, OocEnabledChanged, true); + _config.OnValueChanged(CCVars.LoocEnabled, LoocEnabledChanged, true); + } + + private void OocEnabledChanged(bool value) + { + SetOocButton.Pressed = value; + } + + private void LoocEnabledChanged(bool value) + { + SetLoocButton.Pressed = value; + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (disposing) + { + _config.UnsubValueChanged(CCVars.OocEnabled, OocEnabledChanged); + _config.UnsubValueChanged(CCVars.LoocEnabled, LoocEnabledChanged); + } + } } } diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index 9754c654a8..7a428b222d 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -507,7 +507,7 @@ namespace Content.Shared.CCVar * OOC */ - public static readonly CVarDef OocEnabled = CVarDef.Create("ooc.enabled", true, CVar.NOTIFY); + public static readonly CVarDef OocEnabled = CVarDef.Create("ooc.enabled", true, CVar.NOTIFY | CVar.REPLICATED); public static readonly CVarDef AdminOocEnabled = CVarDef.Create("ooc.enabled_admin", true, CVar.NOTIFY); @@ -516,7 +516,7 @@ namespace Content.Shared.CCVar * LOOC */ - public static readonly CVarDef LoocEnabled = CVarDef.Create("looc.enabled", true, CVar.NOTIFY); + public static readonly CVarDef LoocEnabled = CVarDef.Create("looc.enabled", true, CVar.NOTIFY | CVar.REPLICATED); public static readonly CVarDef AdminLoocEnabled = CVarDef.Create("looc.enabled_admin", true, CVar.NOTIFY);