Beispiel #1
0
    private void UpdateAmmoCount(EntityUid uid, AmmoCounterComponent component)
    {
        if (component.Control == null)
        {
            return;
        }

        var ev = new UpdateAmmoCounterEvent()
        {
            Control = component.Control
        };

        RaiseLocalEvent(uid, ev, false);
    }
Beispiel #2
0
 private void OnBallisticAmmoCount(EntityUid uid, BallisticAmmoProviderComponent component, UpdateAmmoCounterEvent args)
 {
     if (args.Control is DefaultStatusControl control)
     {
         control.Update(GetBallisticShots(component), component.Capacity);
         return;
     }
 }
    private void OnMagazineAmmoUpdate(EntityUid uid, MagazineAmmoProviderComponent component, UpdateAmmoCounterEvent args)
    {
        var ent = GetMagazineEntity(uid);

        if (ent == null)
        {
            if (args.Control is DefaultStatusControl control)
            {
                control.Update(0, 0);
            }

            return;
        }

        RaiseLocalEvent(ent.Value, args, false);
    }
    private void OnAmmoCountUpdate(EntityUid uid, BatteryAmmoProviderComponent component, UpdateAmmoCounterEvent args)
    {
        if (args.Control is not BoxesStatusControl boxes)
        {
            return;
        }

        boxes.Update(component.Shots, component.Capacity);
    }
 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);
     }
 }
Beispiel #6
0
 private void OnRevolverAmmoUpdate(EntityUid uid, RevolverAmmoProviderComponent component, UpdateAmmoCounterEvent args)
 {
     if (args.Control is not RevolverStatusControl control)
     {
         return;
     }
     control.Update(component.CurrentIndex, component.Chambers);
 }
Beispiel #7
0
    private void OnChamberMagazineAmmoUpdate(EntityUid uid, ChamberMagazineAmmoProviderComponent component, UpdateAmmoCounterEvent args)
    {
        if (args.Control is not ChamberMagazineStatusControl control)
        {
            return;
        }

        var chambered   = GetChamberEntity(uid);
        var magEntity   = GetMagazineEntity(uid);
        var ammoCountEv = new GetAmmoCountEvent();

        if (magEntity != null)
        {
            RaiseLocalEvent(magEntity.Value, ref ammoCountEv, false);
        }

        control.Update(chambered != null, magEntity != null, ammoCountEv.Count, ammoCountEv.Capacity);
    }