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:
metalgearsloth
2021-09-20 19:06:48 +10:00
committed by GitHub
parent fcc1217e5d
commit 578ed16b8f
16 changed files with 179 additions and 174 deletions

View File

@@ -0,0 +1,32 @@
using Content.Server.GameTicking;
using Content.Server.Mind.Components;
using Content.Shared.MobState;
using Content.Shared.MobState.State;
using Content.Shared.Movement.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.Body
{
public sealed class BodySystem : EntitySystem
{
[Dependency] private readonly GameTicker _ticker = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<BodyComponent, RelayMoveInputEvent>(OnRelayMoveInput);
}
private void OnRelayMoveInput(EntityUid uid, BodyComponent component, RelayMoveInputEvent args)
{
if (ComponentManager.TryGetComponent<IMobStateComponent>(uid, out var mobState) &&
mobState.IsDead() &&
ComponentManager.TryGetComponent<MindComponent>(uid, out var mind) &&
mind.HasMind)
{
_ticker.OnGhostAttempt(mind.Mind!, true);
}
}
}
}