Files
tbd-station-14/Content.Shared/Pulling/Systems/SharedPullableSystem.cs
metalgearsloth 2b6c352aff Jetpacks (#9023)
* Movement acceleration

* tweaks

* Weightless refactor coz fuck it

* CCVars

* weightless movement tweaks

* Some cleanup while I'm here

* dorkpacks

* thanks fork

* fixes

* zoomies

* toggles

* hmm

* yamls

* b

* so true

* Effects refactor

* namespace

* review
2022-06-24 17:44:30 +10:00

28 lines
1.0 KiB
C#

using Content.Shared.ActionBlocker;
using Content.Shared.Pulling.Components;
using Content.Shared.MobState.Components;
using Content.Shared.Movement.Events;
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);
}
}
}