Zoom user's eye when piloting a shuttle (#6171)

This commit is contained in:
mirrorcult
2022-01-16 13:07:15 -07:00
committed by GitHub
parent c9eae9b17b
commit a997626d00
2 changed files with 18 additions and 0 deletions

View File

@@ -2,6 +2,8 @@ using System.Collections.Generic;
using Content.Shared.Shuttles; using Content.Shared.Shuttles;
using Content.Shared.Shuttles.Components; using Content.Shared.Shuttles.Components;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Maths;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables; using Robust.Shared.ViewVariables;
namespace Content.Server.Shuttles.Components namespace Content.Server.Shuttles.Components
@@ -18,5 +20,11 @@ namespace Content.Server.Shuttles.Components
/// </summary> /// </summary>
[ViewVariables] [ViewVariables]
public bool Enabled { get; set; } = false; public bool Enabled { get; set; } = false;
/// <summary>
/// How much should the pilot's eye be zoomed by when piloting using this console?
/// </summary>
[DataField("zoom")]
public Vector2 Zoom = new(1.5f, 1.5f);
} }
} }

View File

@@ -195,6 +195,11 @@ namespace Content.Server.Shuttles.EntitySystems
return; return;
} }
if (TryComp<SharedEyeComponent>(entity, out var eye))
{
eye.Zoom = component.Zoom;
}
component.SubscribedPilots.Add(pilotComponent); component.SubscribedPilots.Add(pilotComponent);
_alertsSystem.ShowAlert(entity, AlertType.PilotingShuttle); _alertsSystem.ShowAlert(entity, AlertType.PilotingShuttle);
@@ -214,6 +219,11 @@ namespace Content.Server.Shuttles.EntitySystems
pilotComponent.Console = null; pilotComponent.Console = null;
pilotComponent.Position = null; pilotComponent.Position = null;
if (TryComp<SharedEyeComponent>(pilotComponent.Owner, out var eye))
{
eye.Zoom = new(1.0f, 1.0f);
}
if (!helmsman.SubscribedPilots.Remove(pilotComponent)) return; if (!helmsman.SubscribedPilots.Remove(pilotComponent)) return;
_alertsSystem.ClearAlert(pilotComponent.Owner, AlertType.PilotingShuttle); _alertsSystem.ClearAlert(pilotComponent.Owner, AlertType.PilotingShuttle);