Fix zoom command for aghost (#15687)

This commit is contained in:
metalgearsloth
2023-04-23 18:28:51 +10:00
committed by GitHub
parent abde4a718e
commit 9c9c273a4c
6 changed files with 52 additions and 53 deletions

View File

@@ -1,5 +1,9 @@
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;
namespace Content.Client.Commands;
@@ -7,7 +11,9 @@ namespace Content.Client.Commands;
[UsedImplicitly]
public sealed class ZoomCommand : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entManager = default!;
[Dependency] private readonly IEyeManager _eyeMan = default!;
[Dependency] private readonly IPlayerManager _playerManager = default!;
public string Command => "zoom";
public string Description => Loc.GetString("zoom-command-description");
@@ -53,6 +59,14 @@ public sealed class ZoomCommand : IConsoleCommand
}
}
var player = _playerManager.LocalPlayer?.ControlledEntity;
if (_entManager.TryGetComponent<ContentEyeComponent>(player, out var content))
{
_entManager.System<ContentEyeSystem>().RequestZoom(player.Value, zoom, content);
return;
}
_eyeMan.CurrentEye.Zoom = zoom;
}
}