6
2025-11-03 10:15:18 +03:00

21 lines
703 B
C#

using Content.Shared.Weapons.Ranged.Components;
namespace Content.Client.Weapons.Ranged.Systems;
public partial class GunSystem
{
protected override void InitializeBasicEntity()
{
base.InitializeBasicEntity();
SubscribeLocalEvent<BasicEntityAmmoProviderComponent, UpdateAmmoCounterEvent>(OnBasicEntityAmmoCount);
}
private void OnBasicEntityAmmoCount(EntityUid uid, BasicEntityAmmoProviderComponent component, UpdateAmmoCounterEvent args)
{
if (args.Control is DefaultStatusControl control && component.Count != null && component.Capacity != null)
{
control.Update(component.Count.Value, component.Capacity.Value);
}
}
}