using Content.Shared.DeviceLinking;
using Content.Shared.Disposal.Tube;
using Content.Shared.Disposal.Unit;
namespace Content.Shared.Disposal.SignalRouter;
///
/// This handles the emission of signals when entities in disposals
/// pass through a disposal tube with a .
///
public sealed partial class DisposalSignallerSystem : EntitySystem
{
[Dependency] private SharedDeviceLinkSystem _link = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent(OnInit);
SubscribeLocalEvent(OnGetNextDirection, after: new[] { typeof(DisposalTubeSystem) });
}
private void OnInit(Entity ent, ref ComponentInit args)
{
_link.EnsureSourcePorts(ent, ent.Comp.Port);
}
private void OnGetNextDirection(Entity ent, ref GetDisposalsNextDirectionEvent args)
{
_link.InvokePort(ent, ent.Comp.Port);
}
}