Remove IRelayMoveInput (#4663)
* 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>
This commit is contained in:
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using Content.Shared.ActionBlocker;
|
||||
using Content.Shared.Alert;
|
||||
using Content.Shared.Movement;
|
||||
using Content.Shared.Movement.Components;
|
||||
using Content.Shared.Physics.Pull;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
@@ -17,7 +13,7 @@ using Robust.Shared.Serialization;
|
||||
namespace Content.Shared.Pulling.Components
|
||||
{
|
||||
[NetworkedComponent()]
|
||||
public abstract class SharedPullableComponent : Component, IRelayMoveInput
|
||||
public abstract class SharedPullableComponent : Component
|
||||
{
|
||||
public override string Name => "Pullable";
|
||||
|
||||
@@ -348,14 +344,6 @@ namespace Content.Shared.Pulling.Components
|
||||
|
||||
base.OnRemove();
|
||||
}
|
||||
|
||||
// TODO: Need a component bus relay so all entities can use this and not just players
|
||||
void IRelayMoveInput.MoveInputPressed(ICommonSession session)
|
||||
{
|
||||
var entity = session.AttachedEntity;
|
||||
if (entity == null || !EntitySystem.Get<ActionBlockerSystem>().CanMove(entity)) return;
|
||||
TryStopPull();
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable, NetSerializable]
|
||||
|
||||
26
Content.Shared/Pulling/Systems/SharedPullableSystem.cs
Normal file
26
Content.Shared/Pulling/Systems/SharedPullableSystem.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user