Files
tbd-station-14/Content.Shared/Cuffs/SharedCuffableSystem.cs
2021-06-17 00:37:05 +10:00

26 lines
775 B
C#

using Content.Shared.Cuffs.Components;
using Content.Shared.Pulling.Components;
using Robust.Shared.GameObjects;
namespace Content.Shared.Cuffs
{
public abstract class SharedCuffableSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SharedCuffableComponent, StopPullingEvent>(HandleStopPull);
}
private void HandleStopPull(EntityUid uid, SharedCuffableComponent component, StopPullingEvent args)
{
if (args.User == null || !EntityManager.TryGetEntity(args.User.Value, out var user)) return;
if (user == component.Owner && !component.CanStillInteract)
{
args.Cancel();
}
}
}
}