Files
tbd-station-14/Content.Server/Alert/Click/StopPiloting.cs
2021-11-21 17:09:49 +11:00

29 lines
827 B
C#

using Content.Server.Shuttles;
using Content.Server.Shuttles.EntitySystems;
using Content.Shared.Alert;
using Content.Shared.Shuttles;
using Content.Shared.Shuttles.Components;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Alert.Click
{
/// <summary>
/// Stop piloting shuttle
/// </summary>
[UsedImplicitly]
[DataDefinition]
public class StopPiloting : IAlertClick
{
public void AlertClicked(ClickAlertEventArgs args)
{
if (args.Player.TryGetComponent(out PilotComponent? pilotComponent) &&
pilotComponent.Console != null)
{
EntitySystem.Get<ShuttleConsoleSystem>().RemovePilot(pilotComponent);
}
}
}
}