2021-10-05 14:29:03 +11:00
|
|
|
using Content.Shared.Alert;
|
2021-06-09 22:19:39 +02:00
|
|
|
using Content.Shared.Pulling;
|
|
|
|
|
using Content.Shared.Pulling.Components;
|
2021-03-05 01:08:38 +01:00
|
|
|
using JetBrains.Annotations;
|
2020-12-13 14:28:20 -08:00
|
|
|
|
|
|
|
|
namespace Content.Server.Alert.Click
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Stop pulling something
|
|
|
|
|
/// </summary>
|
|
|
|
|
[UsedImplicitly]
|
2021-03-05 01:08:38 +01:00
|
|
|
[DataDefinition]
|
2023-08-22 18:14:33 -07:00
|
|
|
public sealed partial class StopPulling : IAlertClick
|
2020-12-13 14:28:20 -08:00
|
|
|
{
|
2022-01-05 00:19:23 -08:00
|
|
|
public void AlertClicked(EntityUid player)
|
2020-12-13 14:28:20 -08:00
|
|
|
{
|
2022-10-17 02:49:22 +11:00
|
|
|
var entManager = IoCManager.Resolve<IEntityManager>();
|
|
|
|
|
|
|
|
|
|
var ps = entManager.System<SharedPullingSystem>();
|
2022-01-05 00:19:23 -08:00
|
|
|
var playerTarget = ps.GetPulled(player);
|
2022-10-17 02:49:22 +11:00
|
|
|
if (playerTarget != default && entManager.TryGetComponent(playerTarget, out SharedPullableComponent? playerPullable))
|
2021-10-04 16:10:54 +01:00
|
|
|
{
|
2021-12-03 15:09:45 +01:00
|
|
|
ps.TryStopPull(playerPullable);
|
2021-10-04 16:10:54 +01:00
|
|
|
}
|
2020-12-13 14:28:20 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|