Files
tbd-station-14/Content.Server/Alert/Click/StopPiloting.cs
metalgearsloth 1782eb6ad7 Fix even more warnings (#11968)
Also more instances of someone using TryComp instead of HasComp

Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
2022-10-16 08:49:22 -07:00

27 lines
744 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(pilotComponent);
}
}
}
}