mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 10:21:18 +03:00
* First impl. of appearance TryGetData cleanup * Handful of fixes * DamageVisuals: fix HandleDamage call, inheritdoc * bunch of unused AppearanceSystem instances * Handful more unused appearance systems, inheritdoc * JetpackSystem: Ent<T> * cleanup roundup, more Ent<T> * a few lingering AppearanceSystem.TryGetData calls * more lingering AppearanceData access * Remove unnecessary inheritdoc * once again, with feeling
32 lines
976 B
C#
32 lines
976 B
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.TryGetData<bool>(AmmoVisuals.Spent, out var spent))
|
|
return;
|
|
|
|
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);
|
|
}
|
|
}
|