Files
tbd-station-14/Content.Shared/Pulling/Systems/SharedPullableSystem.cs
themias 4f8ee40966 Don't cancel pulling a corpse because the player ghosted (#8621)
* Check if pullable is dead

* Update SharedPullableSystem.cs

Co-authored-by: wrexbe <81056464+wrexbe@users.noreply.github.com>
2022-06-03 19:59:07 -07:00

28 lines
1.0 KiB
C#

using Content.Shared.ActionBlocker;
using Content.Shared.Movement.EntitySystems;
using Content.Shared.Pulling.Components;
using Content.Shared.MobState.Components;
namespace Content.Shared.Pulling.Systems
{
public sealed class SharedPullableSystem : EntitySystem
{
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
[Dependency] private readonly SharedPullingSystem _pullSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SharedPullableComponent, RelayMoveInputEvent>(OnRelayMoveInput);
}
private void OnRelayMoveInput(EntityUid uid, SharedPullableComponent component, RelayMoveInputEvent args)
{
var entity = args.Session.AttachedEntity;
if (entity == null || !_blocker.CanMove(entity.Value)) return;
if (TryComp<MobStateComponent>(component.Owner, out var mobState) && mobState.IsIncapacitated()) return;
_pullSystem.TryStopPull(component);
}
}
}