using Content.Shared.Containers; using Content.Shared.Weapons.Ranged.Components; using Content.Shared.Weapons.Ranged.Events; namespace Content.Shared.Weapons.Ranged.Systems; public partial class SharedGunSystem { private void InitializeClothing() { SubscribeLocalEvent(OnClothingTakeAmmo); SubscribeLocalEvent(OnClothingAmmoCount); } private void OnClothingTakeAmmo(EntityUid uid, ClothingSlotAmmoProviderComponent component, TakeAmmoEvent args) { var getConnectedContainerEvent = new GetConnectedContainerEvent(); RaiseLocalEvent(uid, ref getConnectedContainerEvent); if(!getConnectedContainerEvent.ContainerEntity.HasValue) return; RaiseLocalEvent(getConnectedContainerEvent.ContainerEntity.Value, args); } private void OnClothingAmmoCount(EntityUid uid, ClothingSlotAmmoProviderComponent component, ref GetAmmoCountEvent args) { var getConnectedContainerEvent = new GetConnectedContainerEvent(); RaiseLocalEvent(uid, ref getConnectedContainerEvent); if (!getConnectedContainerEvent.ContainerEntity.HasValue) return; RaiseLocalEvent(getConnectedContainerEvent.ContainerEntity.Value, ref args); } }