Files
tbd-station-14/Content.Shared/Stunnable/StunSystem.cs
metalgearsloth b2322864e9 Remove IActionBlocker.CanMove (#4449)
* Remove IActionBlocker.CanMove

Ported the remainders over to using MovementAttemptEvent which should also help make mob movement a bit faster.

* Make that check faster
2021-08-09 17:34:01 -07:00

33 lines
899 B
C#

using Content.Shared.Movement;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
namespace Content.Shared.Stunnable
{
[UsedImplicitly]
internal sealed class StunSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SharedStunnableComponent, MovementAttemptEvent>(HandleMoveAttempt);
}
private void HandleMoveAttempt(EntityUid uid, SharedStunnableComponent component, MovementAttemptEvent args)
{
if (component.Stunned)
args.Cancel();
}
public override void Update(float frameTime)
{
base.Update(frameTime);
foreach (var component in ComponentManager.EntityQuery<SharedStunnableComponent>(true))
{
component.Update(frameTime);
}
}
}
}