Files
tbd-station-14/Content.Server/GameObjects/EntitySystems/BuckleSystem.cs
2020-11-06 12:38:24 +01:00

47 lines
1.3 KiB
C#

using Content.Server.GameObjects.Components.Buckle;
using Content.Server.GameObjects.EntitySystems.Click;
using JetBrains.Annotations;
using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.Transform;
using Robust.Shared.GameObjects.Systems;
namespace Content.Server.GameObjects.EntitySystems
{
[UsedImplicitly]
internal sealed class BuckleSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
UpdatesAfter.Add(typeof(InteractionSystem));
UpdatesAfter.Add(typeof(InputSystem));
EntityManager.EventBus.SubscribeEvent<MoveEvent>(EventSource.Local, this, MoveEvent);
}
public override void Shutdown()
{
base.Shutdown();
EntityManager.EventBus.UnsubscribeEvent<MoveEvent>(EventSource.Local, this);
}
private void MoveEvent(MoveEvent ev)
{
if (ev.Sender.TryGetComponent(out BuckleComponent buckle))
{
buckle.OnMoveEvent(ev);
}
}
public override void Update(float frameTime)
{
foreach (var buckle in ComponentManager.EntityQuery<BuckleComponent>())
{
buckle.Update();
}
}
}
}