Ensnaring Component and Bola Update (#9968)

This commit is contained in:
keronshb
2022-08-24 10:50:31 -04:00
committed by GitHub
parent 16be5184a4
commit cd78c5451d
29 changed files with 681 additions and 2 deletions

View File

@@ -0,0 +1,25 @@
using Content.Server.Ensnaring;
using Content.Server.Ensnaring.Components;
using Content.Shared.Alert;
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, ensnaringComponent);
}
}
}
}