Zooming for everyone with keyboard keys (#16605)

This commit is contained in:
Artjom
2023-06-17 02:22:21 +03:00
committed by GitHub
parent 9bdaca579e
commit cae037d8a8
5 changed files with 75 additions and 136 deletions

View File

@@ -13,6 +13,7 @@ using Content.Shared.Shuttles.Components;
using Content.Shared.Shuttles.Events;
using Content.Shared.Shuttles.Systems;
using Content.Shared.Tag;
using Content.Shared.Movement.Systems;
using Robust.Server.GameObjects;
using Robust.Shared.Collections;
using Robust.Shared.GameStates;
@@ -33,6 +34,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
[Dependency] private readonly StationSystem _station = default!;
[Dependency] private readonly TagSystem _tags = default!;
[Dependency] private readonly UserInterfaceSystem _ui = default!;
[Dependency] private readonly SharedContentEyeSystem _eyeSystem = default!;
public override void Initialize()
{
@@ -69,7 +71,8 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
RefreshShuttleConsoles();
}
private void OnDestinationMessage(EntityUid uid, ShuttleConsoleComponent component, ShuttleConsoleFTLRequestMessage args)
private void OnDestinationMessage(EntityUid uid, ShuttleConsoleComponent component,
ShuttleConsoleFTLRequestMessage args)
{
if (!TryComp<FTLDestinationComponent>(args.Destination, out var dest))
{
@@ -157,7 +160,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
/// </summary>
private void OnConsoleUIClose(EntityUid uid, ShuttleConsoleComponent component, BoundUIClosedEvent args)
{
if ((ShuttleConsoleUiKey) args.UiKey != ShuttleConsoleUiKey.Key ||
if ((ShuttleConsoleUiKey)args.UiKey != ShuttleConsoleUiKey.Key ||
args.Session.AttachedEntity is not { } user)
{
return;
@@ -172,13 +175,15 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
RemovePilot(user);
}
private void OnConsoleUIOpenAttempt(EntityUid uid, ShuttleConsoleComponent component, ActivatableUIOpenAttemptEvent args)
private void OnConsoleUIOpenAttempt(EntityUid uid, ShuttleConsoleComponent component,
ActivatableUIOpenAttemptEvent args)
{
if (!TryPilot(args.User, uid))
args.Cancel();
}
private void OnConsoleAnchorChange(EntityUid uid, ShuttleConsoleComponent component, ref AnchorStateChangedEvent args)
private void OnConsoleAnchorChange(EntityUid uid, ShuttleConsoleComponent component,
ref AnchorStateChangedEvent args)
{
UpdateState(uid);
}
@@ -398,10 +403,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
return;
}
if (TryComp<SharedEyeComponent>(entity, out var eye))
{
eye.Zoom = component.Zoom;
}
_eyeSystem.SetZoom(entity, component.Zoom, ignoreLimits:true);
component.SubscribedPilots.Add(pilotComponent);
@@ -422,11 +424,7 @@ public sealed partial class ShuttleConsoleSystem : SharedShuttleConsoleSystem
pilotComponent.Console = null;
pilotComponent.Position = null;
if (TryComp<SharedEyeComponent>(pilotUid, out var eye))
{
eye.Zoom = new(1.0f, 1.0f);
}
_eyeSystem.ResetZoom(pilotUid);
if (!helmsman.SubscribedPilots.Remove(pilotComponent))
return;