Files
ss14-wega/Content.Client/Weapons/Ranged/Systems/GunSystem.Magazine.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

39 lines
1.1 KiB
C#

using Content.Shared.Weapons.Ranged;
namespace Content.Client.Weapons.Ranged.Systems;
public sealed partial class GunSystem
{
protected override void InitializeMagazine()
{
base.InitializeMagazine();
SubscribeLocalEvent<MagazineAmmoProviderComponent, UpdateAmmoCounterEvent>(OnMagazineAmmoUpdate);
SubscribeLocalEvent<MagazineAmmoProviderComponent, AmmoCounterControlEvent>(OnMagazineControl);
}
private void OnMagazineAmmoUpdate(Entity<MagazineAmmoProviderComponent> ent, ref UpdateAmmoCounterEvent args)
{
var magEnt = GetMagazineEntity(ent);
if (magEnt == null)
{
if (args.Control is DefaultStatusControl control)
{
control.Update(0, 0);
}
return;
}
RaiseLocalEvent(magEnt.Value, args, false);
}
private void OnMagazineControl(Entity<MagazineAmmoProviderComponent> ent, ref AmmoCounterControlEvent args)
{
var magEnt = GetMagazineEntity(ent);
if (magEnt == null)
return;
RaiseLocalEvent(magEnt.Value, args, false);
}
}