CatStation/Content.Shared/Weapons/Ranged/Systems/SharedGunSystem.Clothing.cs
mq 4920c9e907
Update (MOST) instances of EntityUid, Component in GunSystem to Entity<T> (#41966)
* Entity<T>, skipping Magazine and ChamberMagazine

* missed some

* AUGH!!

* ballistic examine

* dotnet hates me

* WHY ARE YOU CALLED THAT!!!!

* cheers aada
2026-01-01 19:00:49 +00:00

34 lines
1.3 KiB
C#

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<ClothingSlotAmmoProviderComponent, TakeAmmoEvent>(OnClothingTakeAmmo);
SubscribeLocalEvent<ClothingSlotAmmoProviderComponent, GetAmmoCountEvent>(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);
}
}