Make the admin set OOC and LOOC buttons a toggle (#7152)
This commit is contained in:
committed by
GitHub
parent
995c02169e
commit
8ee1503861
@@ -7,7 +7,7 @@
|
||||
Columns="4" >
|
||||
<cc:CommandButton Command="restart" Text="{Loc server-reboot}" />
|
||||
<cc:CommandButton Command="shutdown" Text="{Loc server-shutdown}" />
|
||||
<cc:CommandButton Command="setooc" Text="{Loc server-ooc-toggle}" />
|
||||
<cc:CommandButton Command="setlooc" Text="{Loc server-looc-toggle}" />
|
||||
<cc:CommandButton Name="SetOocButton" Command="setooc" Text="{Loc server-ooc-toggle}" ToggleMode="True" />
|
||||
<cc:CommandButton Name="SetLoocButton" Command="setlooc" Text="{Loc server-looc-toggle}" ToggleMode="True" />
|
||||
</GridContainer>
|
||||
</Control>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ namespace Content.Shared.CCVar
|
||||
* OOC
|
||||
*/
|
||||
|
||||
public static readonly CVarDef<bool> OocEnabled = CVarDef.Create("ooc.enabled", true, CVar.NOTIFY);
|
||||
public static readonly CVarDef<bool> OocEnabled = CVarDef.Create("ooc.enabled", true, CVar.NOTIFY | CVar.REPLICATED);
|
||||
|
||||
public static readonly CVarDef<bool> AdminOocEnabled =
|
||||
CVarDef.Create("ooc.enabled_admin", true, CVar.NOTIFY);
|
||||
@@ -516,7 +516,7 @@ namespace Content.Shared.CCVar
|
||||
* LOOC
|
||||
*/
|
||||
|
||||
public static readonly CVarDef<bool> LoocEnabled = CVarDef.Create("looc.enabled", true, CVar.NOTIFY);
|
||||
public static readonly CVarDef<bool> LoocEnabled = CVarDef.Create("looc.enabled", true, CVar.NOTIFY | CVar.REPLICATED);
|
||||
|
||||
public static readonly CVarDef<bool> AdminLoocEnabled =
|
||||
CVarDef.Create("looc.enabled_admin", true, CVar.NOTIFY);
|
||||
|
||||
Reference in New Issue
Block a user