mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-02-14 19:30:01 +01:00
* Entity<T>, skipping Magazine and ChamberMagazine * missed some * AUGH!! * ballistic examine * dotnet hates me * WHY ARE YOU CALLED THAT!!!! * cheers aada
39 lines
1.1 KiB
C#
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);
|
|
}
|
|
}
|