mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-09-30 16:17:27 +00:00
* 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
(cherry picked from commit 0e306e7862)
71 lines
2.0 KiB
C#
71 lines
2.0 KiB
C#
using Content.Client.Movement.Systems;
|
|
using Content.Shared.Movement.Components;
|
|
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 : LocalizedCommands
|
|
{
|
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
|
|
|
public override string Command => "zoom";
|
|
|
|
public override void Execute(IConsoleShell shell, string argStr, string[] args)
|
|
{
|
|
Vector2 zoom;
|
|
if (args.Length is not (1 or 2))
|
|
{
|
|
shell.WriteLine(Help);
|
|
return;
|
|
}
|
|
|
|
if (!float.TryParse(args[0], out var arg0))
|
|
{
|
|
shell.WriteError(LocalizationManager.GetString("cmd-parse-failure-float", ("arg", args[0])));
|
|
return;
|
|
}
|
|
|
|
if (arg0 > 0)
|
|
zoom = new(arg0, arg0);
|
|
else
|
|
{
|
|
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error"));
|
|
return;
|
|
}
|
|
|
|
if (args.Length == 2)
|
|
{
|
|
if (!float.TryParse(args[1], out var arg1))
|
|
{
|
|
shell.WriteError(LocalizationManager.GetString("cmd-parse-failure-float", ("arg", args[1])));
|
|
return;
|
|
}
|
|
|
|
if (arg1 > 0)
|
|
zoom.Y = arg1;
|
|
else
|
|
{
|
|
shell.WriteError(LocalizationManager.GetString($"cmd-{Command}-error"));
|
|
return;
|
|
}
|
|
}
|
|
|
|
var player = _playerManager.LocalSession?.AttachedEntity;
|
|
|
|
if (_entityManager.TryGetComponent<ContentEyeComponent>(player, out var content))
|
|
{
|
|
_entityManager.System<ContentEyeSystem>().RequestZoom(player.Value, zoom, true, content);
|
|
return;
|
|
}
|
|
|
|
_eyeManager.CurrentEye.Zoom = zoom;
|
|
}
|
|
}
|