Files
crystall-punk-14/Content.Shared/Stunnable/StunSystem.cs

33 lines
896 B
C#
Raw Normal View History

using Content.Shared.Movement;
using JetBrains.Annotations;
using Robust.Shared.GameObjects;
2020-05-13 19:04:50 +02:00
2021-06-09 22:19:39 +02:00
namespace Content.Shared.Stunnable
2020-05-13 19:04:50 +02:00
{
[UsedImplicitly]
internal sealed class StunSystem : EntitySystem
2020-05-13 19:04:50 +02:00
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<SharedStunnableComponent, MovementAttemptEvent>(HandleMoveAttempt);
}
private void HandleMoveAttempt(EntityUid uid, SharedStunnableComponent component, MovementAttemptEvent args)
{
if (component.Stunned)
args.Cancel();
}
2020-05-13 19:04:50 +02:00
public override void Update(float frameTime)
{
base.Update(frameTime);
foreach (var component in EntityManager.EntityQuery<SharedStunnableComponent>(true))
2020-05-13 19:04:50 +02:00
{
component.Update(frameTime);
2020-05-13 19:04:50 +02:00
}
}
}
}