Files
crystall-punk-14/Content.Server/Body/BodySystem.cs

32 lines
1016 B
C#
Raw Normal View History

using Content.Server.GameTicking;
using Content.Server.Mind.Components;
2021-11-08 15:11:58 +01:00
using Content.Shared.MobState.Components;
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)
{
2021-11-08 15:11:58 +01:00
if (EntityManager.TryGetComponent<MobStateComponent>(uid, out var mobState) &&
mobState.IsDead() &&
EntityManager.TryGetComponent<MindComponent>(uid, out var mind) &&
mind.HasMind)
{
_ticker.OnGhostAttempt(mind.Mind!, true);
}
}
}
}