Add panic bunker toggle to admin menu (#13450)
This commit is contained in:
@@ -5,9 +5,9 @@
|
|||||||
MinSize="50 50">
|
MinSize="50 50">
|
||||||
<GridContainer
|
<GridContainer
|
||||||
Columns="4" >
|
Columns="4" >
|
||||||
<cc:CommandButton Command="restart" Text="{Loc server-reboot}" />
|
|
||||||
<cc:CommandButton Command="shutdown" Text="{Loc server-shutdown}" />
|
<cc:CommandButton Command="shutdown" Text="{Loc server-shutdown}" />
|
||||||
<cc:CommandButton Name="SetOocButton" Command="setooc" Text="{Loc server-ooc-toggle}" ToggleMode="True" />
|
<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" />
|
<cc:CommandButton Name="SetLoocButton" Command="setlooc" Text="{Loc server-looc-toggle}" ToggleMode="True" />
|
||||||
|
<cc:CommandButton Name="SetPanicbunkerButton" Command="panicbunker" Text="{Loc server-panicbunker-toggle}" ToggleMode="True" />
|
||||||
</GridContainer>
|
</GridContainer>
|
||||||
</Control>
|
</Control>
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ namespace Content.Client.Administration.UI.Tabs
|
|||||||
|
|
||||||
_config.OnValueChanged(CCVars.OocEnabled, OocEnabledChanged, true);
|
_config.OnValueChanged(CCVars.OocEnabled, OocEnabledChanged, true);
|
||||||
_config.OnValueChanged(CCVars.LoocEnabled, LoocEnabledChanged, true);
|
_config.OnValueChanged(CCVars.LoocEnabled, LoocEnabledChanged, true);
|
||||||
|
_config.OnValueChanged(CCVars.PanicBunkerEnabled, BunkerEnabledChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OocEnabledChanged(bool value)
|
private void OocEnabledChanged(bool value)
|
||||||
@@ -30,6 +31,11 @@ namespace Content.Client.Administration.UI.Tabs
|
|||||||
SetLoocButton.Pressed = value;
|
SetLoocButton.Pressed = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BunkerEnabledChanged(bool value)
|
||||||
|
{
|
||||||
|
SetPanicbunkerButton.Pressed = value;
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
@@ -38,6 +44,7 @@ namespace Content.Client.Administration.UI.Tabs
|
|||||||
{
|
{
|
||||||
_config.UnsubValueChanged(CCVars.OocEnabled, OocEnabledChanged);
|
_config.UnsubValueChanged(CCVars.OocEnabled, OocEnabledChanged);
|
||||||
_config.UnsubValueChanged(CCVars.LoocEnabled, LoocEnabledChanged);
|
_config.UnsubValueChanged(CCVars.LoocEnabled, LoocEnabledChanged);
|
||||||
|
_config.UnsubValueChanged(CCVars.PanicBunkerEnabled, BunkerEnabledChanged);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,21 +12,30 @@ public sealed class PanicBunkerCommand : IConsoleCommand
|
|||||||
|
|
||||||
public string Command => "panicbunker";
|
public string Command => "panicbunker";
|
||||||
public string Description => "Enables or disables the panic bunker functionality.";
|
public string Description => "Enables or disables the panic bunker functionality.";
|
||||||
public string Help => "panicbunker <enabled>";
|
public string Help => "panicbunker";
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
if (args.Length != 1)
|
if (args.Length > 1)
|
||||||
{
|
{
|
||||||
shell.WriteError(Loc.GetString("shell-wrong-arguments-number"));
|
shell.WriteError(Loc.GetString("shell-need-between-arguments",("lower", 0), ("upper", 1)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bool.TryParse(args[0], out var enabled))
|
var enabled = _cfg.GetCVar(CCVars.PanicBunkerEnabled);
|
||||||
|
|
||||||
|
if (args.Length == 0)
|
||||||
{
|
{
|
||||||
shell.WriteError(Loc.GetString("shell-invalid-bool"));
|
enabled = !enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.Length == 1 && !bool.TryParse(args[0], out enabled))
|
||||||
|
{
|
||||||
|
shell.WriteError(Loc.GetString("shell-argument-must-be-boolean"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_cfg.SetCVar(CCVars.PanicBunkerEnabled, enabled);
|
_cfg.SetCVar(CCVars.PanicBunkerEnabled, enabled);
|
||||||
|
|
||||||
|
shell.WriteLine(Loc.GetString(enabled ? "panicbunker-command-enabled" : "panicbunker-command-disabled"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ namespace Content.Shared.CCVar
|
|||||||
/// Whether or not panic bunker is currently enabled.
|
/// Whether or not panic bunker is currently enabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly CVarDef<bool> PanicBunkerEnabled =
|
public static readonly CVarDef<bool> PanicBunkerEnabled =
|
||||||
CVarDef.Create("game.panic_bunker.enabled", false, CVar.SERVERONLY);
|
CVarDef.Create("game.panic_bunker.enabled", false, CVar.NOTIFY | CVar.REPLICATED);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show reason of disconnect for user or not.
|
/// Show reason of disconnect for user or not.
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
panicbunker-command-enabled = Panic bunker has been enabled.
|
||||||
|
panicbunker-command-disabled = Panic bunker has been disabled.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
server-reboot = Reboot
|
|
||||||
server-shutdown = Shutdown
|
server-shutdown = Shutdown
|
||||||
server-ooc-toggle = Toggle OOC
|
server-ooc-toggle = Toggle OOC
|
||||||
server-looc-toggle = Toggle LOOC
|
server-looc-toggle = Toggle LOOC
|
||||||
|
server-panicbunker-toggle = Toggle Panic bunker
|
||||||
|
|||||||
Reference in New Issue
Block a user