mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +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
1.2 KiB
C#
32 lines
1.2 KiB
C#
using Content.Shared.Actions;
|
|
using Content.Shared.Actions.Components;
|
|
using Robust.Client.GameObjects;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Client.Actions;
|
|
|
|
public sealed partial class ActionIconVisualsSystem : VisualizerSystem<ActionComponent>
|
|
{
|
|
/// <inheritdoc/>
|
|
protected override void OnAppearanceChange(EntityUid uid, ActionComponent comp, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null)
|
|
return;
|
|
|
|
if (args.TryGetData<SpriteSpecifier>(ActionState.DynamicIcon, out var icon))
|
|
{
|
|
if (icon is SpriteSpecifier.EntityPrototype)
|
|
SpriteSystem.LayerSetTexture((uid, args.Sprite), ActionVisuals.Icon, SpriteSystem.Frame0(icon));
|
|
else
|
|
SpriteSystem.LayerSetSprite((uid, args.Sprite), ActionVisuals.Icon, icon);
|
|
}
|
|
|
|
if (args.TryGetData<Color>(ActionState.Color, out var color))
|
|
{
|
|
SpriteSystem.LayerSetColor((uid, args.Sprite), ActionVisuals.Icon, color);
|
|
|
|
if (SpriteSystem.LayerExists((uid, args.Sprite), ActionVisuals.IconToggled))
|
|
SpriteSystem.LayerSetColor((uid, args.Sprite), ActionVisuals.IconToggled, color);
|
|
}
|
|
}
|
|
}
|