Files
tbd-station-14/Content.Server/Alert/Click/RemoveEnsnare.cs
Vordenburg 7ebe16dd3d Fix snares (#16699)
The alert for snares will appear again. Previously it was being updated
on the snare itself and not the player.

It is no longer possible to infinitely ensnare someone; the maximum
number is dependent on the target's legs.

Only one snare at a time will be removed now.

Clarified the wording and logic around CanMoveBreakout. It was
inconsistent.

Made multiple snares impose cumulative speed penalties.

It is no longer possible to remove bolas while moving.
2023-05-22 15:49:37 -06:00

29 lines
947 B
C#

using Content.Server.Ensnaring;
using Content.Shared.Alert;
using Content.Shared.Ensnaring.Components;
using JetBrains.Annotations;
namespace Content.Server.Alert.Click;
[UsedImplicitly]
[DataDefinition]
public sealed class RemoveEnsnare : IAlertClick
{
public void AlertClicked(EntityUid player)
{
var entManager = IoCManager.Resolve<IEntityManager>();
if (entManager.TryGetComponent(player, out EnsnareableComponent? ensnareableComponent))
{
foreach (var ensnare in ensnareableComponent.Container.ContainedEntities)
{
if (!entManager.TryGetComponent(ensnare, out EnsnaringComponent? ensnaringComponent))
return;
entManager.EntitySysManager.GetEntitySystem<EnsnareableSystem>().TryFree(player, player, ensnare, ensnaringComponent);
// Only one snare at a time.
break;
}
}
}
}