* Cleanup warnings in MagazineVisualsSpriteTest * Cleanup warnings in WiresVisualizerSystem * Cleanup warnings in GunSystem.SpentAmmo * Cleanup warnings in GunSystem * Cleanup warnings in GunSystem.ChamberMagazine * Cleanup warnings in MeleeWeaponSystem.Effects * Cleanup warnings in ToggleableLightVisualsSystem * Cleanup warnings in StatusIconOverlay * Cleanup warnings in SpriteFadeSystem * Cleanup warnings in PdaVisualizerSystem * Cleanup warnings in EnvelopeSystem * Cleanup warnings in MechSystem * Cleanup warnings in MappingOverlay * Cleanup warnings in LockVisualizerSystem * Cleanup warnings in DragDropSystem * Cleanup warnings in GhostSystem * Cleanup warnings in TriggerSystem.Proximity * Cleanup warnings in DragonSystem * Cleanup warnings in PortableScrubberVisualsSystem * File-scoped namespace for PortableScrubberVisualsSystem
36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
using Content.Client.Weapons.Ranged.Components;
|
|
using Content.Shared.Weapons.Ranged.Systems;
|
|
using Robust.Client.GameObjects;
|
|
|
|
namespace Content.Client.Weapons.Ranged.Systems;
|
|
|
|
public sealed partial class GunSystem
|
|
{
|
|
private void InitializeSpentAmmo()
|
|
{
|
|
SubscribeLocalEvent<SpentAmmoVisualsComponent, AppearanceChangeEvent>(OnSpentAmmoAppearance);
|
|
}
|
|
|
|
private void OnSpentAmmoAppearance(EntityUid uid, SpentAmmoVisualsComponent component, ref AppearanceChangeEvent args)
|
|
{
|
|
var sprite = args.Sprite;
|
|
if (sprite == null) return;
|
|
|
|
if (!args.AppearanceData.TryGetValue(AmmoVisuals.Spent, out var varSpent))
|
|
{
|
|
return;
|
|
}
|
|
|
|
var spent = (bool) varSpent;
|
|
string state;
|
|
|
|
if (spent)
|
|
state = component.Suffix ? $"{component.State}-spent" : "spent";
|
|
else
|
|
state = component.State;
|
|
|
|
_sprite.LayerSetRsiState((uid, sprite), AmmoVisualLayers.Base, state);
|
|
_sprite.RemoveLayer((uid, sprite), AmmoVisualLayers.Tip, false);
|
|
}
|
|
}
|