Client commands: clean up and localize (#22897)

* action commands

* atmos debug commands

* comming

* credits command

* debug commands

* usage

* usings

* debug pathfinding command

* grouping entity menu command

* hide mechanisms command

* commit

* mapping client side setup command

* open ahelp command

* set menu visibility command

* commit

* show mechanisms command

* toggle health overlay command

* toggle outline command

* stage

* disable once

* ioc

* namespaces

* WriteError

* clean up command usage

* don't abbriviate

* ActionsCommands

* AtmosDebugCommands

* the rest

* oops

* undo
This commit is contained in:
PrPleGoo
2024-01-03 23:29:37 +01:00
committed by GitHub
parent e790e59e19
commit 0e306e7862
28 changed files with 495 additions and 447 deletions

View File

@@ -6,66 +6,71 @@ using Robust.Client.GameObjects;
using Robust.Shared.Console;
using DrawDepth = Content.Shared.DrawDepth.DrawDepth;
namespace Content.Client.Commands
namespace Content.Client.Commands;
internal sealed class ShowMarkersCommand : LocalizedCommands
{
internal sealed class ShowMarkersCommand : IConsoleCommand
{
// ReSharper disable once StringLiteralTypo
public string Command => "showmarkers";
public string Description => "Toggles visibility of markers such as spawn points.";
public string Help => "";
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<MarkerSystem>().MarkersVisible ^= true;
}
public override string Command => "showmarkers";
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
_entitySystemManager.GetEntitySystem<MarkerSystem>().MarkersVisible ^= true;
}
}
internal sealed class ShowSubFloor : IConsoleCommand
internal sealed class ShowSubFloor : LocalizedCommands
{
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
public override string Command => "showsubfloor";
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
// ReSharper disable once StringLiteralTypo
public string Command => "showsubfloor";
public string Description => "Makes entities below the floor always visible.";
public string Help => $"Usage: {Command}";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<SubFloorHideSystem>().ShowAll ^= true;
}
_entitySystemManager.GetEntitySystem<SubFloorHideSystem>().ShowAll ^= true;
}
}
internal sealed class ShowSubFloorForever : IConsoleCommand
internal sealed class ShowSubFloorForever : LocalizedCommands
{
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
public const string CommandName = "showsubfloorforever";
public override string Command => CommandName;
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
// ReSharper disable once StringLiteralTypo
public string Command => "showsubfloorforever";
public string Description => "Makes entities below the floor always visible until the client is restarted.";
public string Help => $"Usage: {Command}";
_entitySystemManager.GetEntitySystem<SubFloorHideSystem>().ShowAll = true;
public void Execute(IConsoleShell shell, string argStr, string[] args)
var entMan = IoCManager.Resolve<IEntityManager>();
var components = entMan.EntityQuery<SubFloorHideComponent, SpriteComponent>(true);
foreach (var (_, sprite) in components)
{
EntitySystem.Get<SubFloorHideSystem>().ShowAll = true;
var entMan = IoCManager.Resolve<IEntityManager>();
var components = entMan.EntityQuery<SubFloorHideComponent, SpriteComponent>(true);
foreach (var (_, sprite) in components)
{
sprite.DrawDepth = (int) DrawDepth.Overlays;
}
}
}
internal sealed class NotifyCommand : IConsoleCommand
{
public string Command => "notify";
public string Description => "Send a notify client side.";
public string Help => "notify <message>";
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
var message = args[0];
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<PopupSystem>().PopupCursor(message);
sprite.DrawDepth = (int) DrawDepth.Overlays;
}
}
}
internal sealed class NotifyCommand : LocalizedCommands
{
[Dependency] private readonly IEntitySystemManager _entitySystemManager = default!;
public override string Command => "notify";
public override string Help => LocalizationManager.GetString($"cmd-{Command}-help", ("command", Command));
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
var message = args[0];
_entitySystemManager.GetEntitySystem<PopupSystem>().PopupCursor(message);
}
}