Files
tbd-station-14/Content.Server/Alert/Click/StopBeingPulled.cs
2021-10-11 15:23:45 -07:00

30 lines
856 B
C#

using Content.Shared.ActionBlocker;
using Content.Shared.Alert;
using Content.Shared.Pulling.Components;
using Content.Shared.Pulling;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Server.Alert.Click
{
/// <summary>
/// Stop pulling something
/// </summary>
[UsedImplicitly]
[DataDefinition]
public class StopBeingPulled : IAlertClick
{
public void AlertClicked(ClickAlertEventArgs args)
{
if (!EntitySystem.Get<ActionBlockerSystem>().CanInteract(args.Player))
return;
if (args.Player.TryGetComponent<SharedPullableComponent>(out var playerPullable))
{
EntitySystem.Get<SharedPullingSystem>().TryStopPull(playerPullable);
}
}
}
}