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

@@ -1,26 +1,23 @@
using System.Numerics;
using Content.Client.Movement.Systems;
using Content.Shared.Movement.Components;
using Content.Shared.Movement.Systems;
using JetBrains.Annotations;
using Robust.Client.Graphics;
using Robust.Client.Player;
using Robust.Shared.Console;
using System.Numerics;
namespace Content.Client.Commands;
[UsedImplicitly]
public sealed class ZoomCommand : IConsoleCommand
public sealed class ZoomCommand : LocalizedCommands
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IEyeManager _eyeMan = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IEyeManager _eyeManager = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
public string Command => "zoom";
public string Description => Loc.GetString("zoom-command-description");
public string Help => Loc.GetString("zoom-command-help");
public override string Command => "zoom";
public void Execute(IConsoleShell shell, string argStr, string[] args)
public override void Execute(IConsoleShell shell, string argStr, string[] args)
{
Vector2 zoom;
if (args.Length is not (1 or 2))
@@ -31,7 +28,7 @@ public sealed class ZoomCommand : IConsoleCommand
if (!float.TryParse(args[0], out var arg0))
{
shell.WriteError(Loc.GetString("cmd-parse-failure-float", ("arg", args[0])));
shell.WriteError(LocalizationManager.GetString("cmd-parse-failure-float", ("arg", args[0])));
return;
}
@@ -39,7 +36,7 @@ public sealed class ZoomCommand : IConsoleCommand
zoom = new(arg0, arg0);
else
{
shell.WriteError(Loc.GetString("zoom-command-error"));
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error"));
return;
}
@@ -47,7 +44,7 @@ public sealed class ZoomCommand : IConsoleCommand
{
if (!float.TryParse(args[1], out var arg1))
{
shell.WriteError(Loc.GetString("cmd-parse-failure-float", ("arg", args[1])));
shell.WriteError(LocalizationManager.GetString("cmd-parse-failure-float", ("arg", args[1])));
return;
}
@@ -55,19 +52,19 @@ public sealed class ZoomCommand : IConsoleCommand
zoom.Y = arg1;
else
{
shell.WriteError(Loc.GetString("zoom-command-error"));
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error"));
return;
}
}
var player = _playerManager.LocalPlayer?.ControlledEntity;
var player = _playerManager.LocalSession?.AttachedEntity;
if (_entManager.TryGetComponent<ContentEyeComponent>(player, out var content))
if (_entityManager.TryGetComponent<ContentEyeComponent>(player, out var content))
{
_entManager.System<ContentEyeSystem>().RequestZoom(player.Value, zoom, true, content);
_entityManager.System<ContentEyeSystem>().RequestZoom(player.Value, zoom, true, content);
return;
}
_eyeMan.CurrentEye.Zoom = zoom;
_eyeManager.CurrentEye.Zoom = zoom;
}
}