2021-10-05 14:29:03 +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-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>();
|
2024-03-19 14:30:56 +11:00
|
|
|
var ps = entManager.System<PullingSystem>();
|
2022-10-17 02:49:22 +11:00
|
|
|
|
2024-03-19 14:30:56 +11:00
|
|
|
if (entManager.TryGetComponent(player, out PullerComponent? puller) &&
|
|
|
|
|
entManager.TryGetComponent(puller.Pulling, out PullableComponent? pullableComp))
|
2021-10-04 16:10:54 +01:00
|
|
|
{
|
2024-03-19 14:30:56 +11:00
|
|
|
ps.TryStopPull(puller.Pulling.Value, pullableComp, user: player);
|
2021-10-04 16:10:54 +01:00
|
|
|
}
|
2020-12-13 14:28:20 -08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|