using Content.Shared.Emp; using Content.Shared.Kitchen; using Content.Shared.Power; using Content.Shared.PowerCell.Components; using Content.Shared.Rejuvenate; namespace Content.Shared.PowerCell; public sealed partial class PowerCellSystem { public void InitializeRelay() { SubscribeLocalEvent(RelayToCell); SubscribeLocalEvent(RelayToCell); SubscribeLocalEvent(RelayToCell); SubscribeLocalEvent(RelayToCell); SubscribeLocalEvent(RelayToCellSlot); // Prevent the ninja from EMPing its own battery SubscribeLocalEvent(RelayToCellSlot); SubscribeLocalEvent(RelayToCellSlot); // For shutting down devices if the battery is empty SubscribeLocalEvent(RelayToCellSlot); // Allow devices to charge/drain inserted batteries } private void RelayToCell(Entity ent, ref T args) where T : notnull { if (!_itemSlots.TryGetSlot(ent.Owner, ent.Comp.CellSlotId, out var slot) || !slot.Item.HasValue) return; // Relay the event to the power cell. RaiseLocalEvent(slot.Item.Value, ref args); } private void RelayToCellSlot(Entity ent, ref T args) where T : notnull { var parent = Transform(ent).ParentUid; // Relay the event to the slot entity. if (HasComp(parent)) RaiseLocalEvent(parent, ref args); } }