2021-10-11 15:23:45 -07:00
|
|
|
using Content.Shared.ActionBlocker;
|
2021-03-08 12:10:48 +11:00
|
|
|
using Content.Shared.Alert;
|
2024-03-19 14:30:56 +11:00
|
|
|
using Content.Shared.Movement.Pulling.Components;
|
|
|
|
|
using Content.Shared.Movement.Pulling.Systems;
|
2021-03-08 12:10:48 +11:00
|
|
|
using JetBrains.Annotations;
|
|
|
|
|
|
|
|
|
|
namespace Content.Server.Alert.Click
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Stop pulling something
|
|
|
|
|
/// </summary>
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
|
[DataDefinition]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class StopBeingPulled : IAlertClick
|
2021-03-08 12:10:48 +11:00
|
|
|
{
|
2022-01-05 00:19:23 -08:00
|
|
|
public void AlertClicked(EntityUid player)
|
2021-03-08 12:10:48 +11:00
|
|
|
{
|
2022-10-17 02:49:22 +11:00
|
|
|
var entityManager = IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
|
|
|
|
|
if (!entityManager.System<ActionBlockerSystem>().CanInteract(player, null))
|
2021-10-11 15:23:45 -07:00
|
|
|
return;
|
|
|
|
|
|
2024-03-19 14:30:56 +11:00
|
|
|
if (entityManager.TryGetComponent(player, out PullableComponent? playerPullable))
|
2021-10-04 16:10:54 +01:00
|
|
|
{
|
2024-03-19 14:30:56 +11:00
|
|
|
entityManager.System<PullingSystem>().TryStopPull(player, playerPullable, user: player);
|
2021-10-04 16:10:54 +01:00
|
|
|
}
|
2021-03-08 12:10:48 +11:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|