Files
tbd-station-14/Content.Server/Alert/Click/StopPiloting.cs
2023-07-09 02:02:17 +10:00

27 lines
748 B
C#

using Content.Server.Shuttles.Systems;
using Content.Shared.Alert;
using Content.Shared.Shuttles.Components;
using JetBrains.Annotations;
namespace Content.Server.Alert.Click
{
/// <summary>
/// Stop piloting shuttle
/// </summary>
[UsedImplicitly]
[DataDefinition]
public sealed class StopPiloting : IAlertClick
{
public void AlertClicked(EntityUid player)
{
var entManager = IoCManager.Resolve<IEntityManager>();
if (entManager.TryGetComponent(player, out PilotComponent? pilotComponent)
&& pilotComponent.Console != null)
{
entManager.System<ShuttleConsoleSystem>().RemovePilot(player, pilotComponent);
}
}
}
}