mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* basic code porting * prototypes port * rendering update * charge state * helper * fix * forgotten one
31 lines
1.2 KiB
C#
31 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>
|
|
{
|
|
protected override void OnAppearanceChange(EntityUid uid, ActionComponent comp, ref AppearanceChangeEvent args)
|
|
{
|
|
if (args.Sprite == null)
|
|
return;
|
|
|
|
if (AppearanceSystem.TryGetData<SpriteSpecifier>(uid, ActionState.DynamicIcon, out var icon, args.Component))
|
|
{
|
|
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 (AppearanceSystem.TryGetData<Color>(uid, ActionState.Color, out var color, args.Component))
|
|
{
|
|
SpriteSystem.LayerSetColor((uid, args.Sprite), ActionVisuals.Icon, color);
|
|
|
|
if (SpriteSystem.LayerExists((uid, args.Sprite), ActionVisuals.IconToggled))
|
|
SpriteSystem.LayerSetColor((uid, args.Sprite), ActionVisuals.IconToggled, color);
|
|
}
|
|
}
|
|
}
|