2021-09-20 19:06:48 +10:00
|
|
|
using Content.Shared.ActionBlocker;
|
|
|
|
|
using Content.Shared.Pulling.Components;
|
2022-06-03 22:59:07 -04:00
|
|
|
using Content.Shared.MobState.Components;
|
2022-06-24 17:44:30 +10:00
|
|
|
using Content.Shared.Movement.Events;
|
2021-09-20 19:06:48 +10:00
|
|
|
|
|
|
|
|
namespace Content.Shared.Pulling.Systems
|
|
|
|
|
{
|
2022-02-16 00:23:23 -07:00
|
|
|
public sealed class SharedPullableSystem : EntitySystem
|
2021-09-20 19:06:48 +10:00
|
|
|
{
|
|
|
|
|
[Dependency] private readonly ActionBlockerSystem _blocker = default!;
|
2021-10-04 16:10:54 +01:00
|
|
|
[Dependency] private readonly SharedPullingSystem _pullSystem = default!;
|
2021-09-20 19:06:48 +10:00
|
|
|
|
|
|
|
|
public override void Initialize()
|
|
|
|
|
{
|
|
|
|
|
base.Initialize();
|
|
|
|
|
SubscribeLocalEvent<SharedPullableComponent, RelayMoveInputEvent>(OnRelayMoveInput);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void OnRelayMoveInput(EntityUid uid, SharedPullableComponent component, RelayMoveInputEvent args)
|
|
|
|
|
{
|
2021-12-05 18:09:01 +01:00
|
|
|
var entity = args.Session.AttachedEntity;
|
2021-12-06 15:34:46 +01:00
|
|
|
if (entity == null || !_blocker.CanMove(entity.Value)) return;
|
2022-06-03 22:59:07 -04:00
|
|
|
if (TryComp<MobStateComponent>(component.Owner, out var mobState) && mobState.IsIncapacitated()) return;
|
2021-10-04 16:10:54 +01:00
|
|
|
_pullSystem.TryStopPull(component);
|
2021-09-20 19:06:48 +10:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|