2021-07-04 18:11:52 +02:00
|
|
|
|
using Content.Client.Administration.Managers;
|
|
|
|
|
|
using Content.Shared.Administration;
|
|
|
|
|
|
using Robust.Shared.Console;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Content.Client.NodeContainer
|
|
|
|
|
|
{
|
2025-06-17 14:08:12 -04:00
|
|
|
|
public sealed class NodeVisCommand : LocalizedEntityCommands
|
2021-07-04 18:11:52 +02:00
|
|
|
|
{
|
2025-06-17 14:08:12 -04:00
|
|
|
|
[Dependency] private readonly IClientAdminManager _adminManager = default!;
|
|
|
|
|
|
[Dependency] private readonly NodeGroupSystem _nodeSystem = default!;
|
2024-05-12 17:34:52 -07:00
|
|
|
|
|
2025-06-17 14:08:12 -04:00
|
|
|
|
public override string Command => "nodevis";
|
2021-07-04 18:11:52 +02:00
|
|
|
|
|
2025-06-17 14:08:12 -04:00
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
2021-07-04 18:11:52 +02:00
|
|
|
|
{
|
2025-06-17 14:08:12 -04:00
|
|
|
|
if (!_adminManager.HasFlag(AdminFlags.Debug))
|
2021-07-04 18:11:52 +02:00
|
|
|
|
{
|
2025-06-17 14:08:12 -04:00
|
|
|
|
shell.WriteError(Loc.GetString($"shell-missing-required-permission", ("perm", "+DEBUG")));
|
2021-07-04 18:11:52 +02:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-17 14:08:12 -04:00
|
|
|
|
_nodeSystem.SetVisEnabled(!_nodeSystem.VisEnabled);
|
2021-07-04 18:11:52 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-17 14:08:12 -04:00
|
|
|
|
public sealed class NodeVisFilterCommand : LocalizedEntityCommands
|
2021-07-04 18:11:52 +02:00
|
|
|
|
{
|
2025-06-17 14:08:12 -04:00
|
|
|
|
[Dependency] private readonly NodeGroupSystem _nodeSystem = default!;
|
2024-05-12 17:34:52 -07:00
|
|
|
|
|
2025-06-17 14:08:12 -04:00
|
|
|
|
public override string Command => "nodevisfilter";
|
2021-07-04 18:11:52 +02:00
|
|
|
|
|
2025-06-17 14:08:12 -04:00
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
2021-07-04 18:11:52 +02:00
|
|
|
|
{
|
|
|
|
|
|
if (args.Length == 0)
|
|
|
|
|
|
{
|
2025-06-17 14:08:12 -04:00
|
|
|
|
foreach (var filtered in _nodeSystem.Filtered)
|
2021-07-04 18:11:52 +02:00
|
|
|
|
{
|
|
|
|
|
|
shell.WriteLine(filtered);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
var filter = args[0];
|
2025-06-17 14:08:12 -04:00
|
|
|
|
if (!_nodeSystem.Filtered.Add(filter))
|
|
|
|
|
|
_nodeSystem.Filtered.Remove(filter);
|
2021-07-04 18:11:52 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|