using Content.Shared._Goobstation.Factory.Filters; using Content.Shared.DeviceLinking; using Robust.Shared.Containers; namespace Content.Shared._Goobstation.Factory; public sealed class StorageBinSystem : EntitySystem { [Dependency] private readonly AutomationFilterSystem _filter = default!; [Dependency] private readonly SharedDeviceLinkSystem _device = default!; public const string ContainerId = "storagebase"; public override void Initialize() { base.Initialize(); SubscribeLocalEvent(OnInsertAttempt); SubscribeLocalEvent(OnEntInserted); SubscribeLocalEvent(OnEntRemoved); } private void OnInsertAttempt(Entity ent, ref ContainerIsInsertingAttemptEvent args) { if (args.Container.ID != ContainerId) return; if (_filter.IsBlocked(_filter.GetSlot(ent), args.EntityUid)) args.Cancel(); } private void OnEntInserted(Entity ent, ref EntInsertedIntoContainerMessage args) { if (args.Container.ID != ContainerId) return; _device.InvokePort(ent, ent.Comp.InsertedPort); } private void OnEntRemoved(Entity ent, ref EntRemovedFromContainerMessage args) { if (args.Container.ID != ContainerId) return; _device.InvokePort(ent, ent.Comp.RemovedPort); } }