mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-02-14 23:14:45 +01:00
* Entity<T>, skipping Magazine and ChamberMagazine * missed some * AUGH!! * ballistic examine * dotnet hates me * WHY ARE YOU CALLED THAT!!!! * cheers aada
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(Entity<SpentAmmoVisualsComponent> ent, 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 = ent.Comp.Suffix ? $"{ent.Comp.State}-spent" : "spent";
|
|
else
|
|
state = ent.Comp.State;
|
|
|
|
_sprite.LayerSetRsiState((ent, sprite), AmmoVisualLayers.Base, state);
|
|
_sprite.RemoveLayer((ent, sprite), AmmoVisualLayers.Tip, false);
|
|
}
|
|
}
|