* Remove IRelayMoveInput This interface gets called every time a movement key is pressed so it gets called a lot. * Remove RelayMovementEntityMessage Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
27 lines
856 B
C#
27 lines
856 B
C#
using Content.Shared.ActionBlocker;
|
|
using Content.Shared.Movement.EntitySystems;
|
|
using Content.Shared.Pulling.Components;
|
|
using Robust.Shared.GameObjects;
|
|
using Robust.Shared.IoC;
|
|
|
|
namespace Content.Shared.Pulling.Systems
|
|
{
|
|
public class SharedPullableSystem : EntitySystem
|
|
{
|
|
[Dependency] private readonly ActionBlockerSystem _blocker = 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)) return;
|
|
component.TryStopPull();
|
|
}
|
|
}
|
|
}
|