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:
32
Content.Server/Body/BodySystem.cs
Normal file
32
Content.Server/Body/BodySystem.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user