CatStation/Content.Client/Weapons/Ranged/Systems/GunSystem.Magazine.cs
Pok e7897d76a4
More item status (#39264)
* more-item-status

* update 1

* update 2

* Update pistol.yml

* update 3

* yml

* oops

* BatteryItemStatus

* fix ChargeItemStatus

* Update item-status.ftl

* review update 1

* review fix 1

* Update BatteryInfoSystem.cs

* Update TimerTriggerItemStatus

* merge fix

* merge fix

* review update 2

* review update 3

* fix marge

* StyleNano

* review update 4

* review update 5

* BatteryItemStatus

* BatteryItemStatus Client

* code cleanup

* merge

* merge and GasTank fix

* Merge

* unnecessary components

* review

* oops

* GasTank

* wawa
2026-07-19 23:41:09 +00:00

43 lines
1.3 KiB
C#

using Content.Client.Items;
using Content.Client.Weapons.Ranged.UI;
using Content.Shared.Weapons.Ranged;
using Content.Shared.Weapons.Ranged.Components;
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);
Subs.ItemStatus<BallisticAmmoProviderComponent>(entity => new MagazineStatusControl(entity));
}
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);
}
}