CatStation/Content.Client/IconSmoothing/ClientRandomIconSmoothSystem.cs
Pieter-Jan Briers 5168b5f3d4
IoC source gen compatibility (#43863)
* IoC source gen compatibility

Can be merged before or after https://github.com/space-wizards/RobustToolbox/pull/6549 doesn't really matter.

* Missed a spot
2026-05-09 03:29:58 +00:00

29 lines
937 B
C#

using Content.Shared.IconSmoothing;
using Robust.Client.GameObjects;
namespace Content.Client.IconSmoothing;
public sealed partial class ClientRandomIconSmoothSystem : SharedRandomIconSmoothSystem
{
[Dependency] private IconSmoothSystem _iconSmooth = default!;
[Dependency] private AppearanceSystem _appearance = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RandomIconSmoothComponent, AppearanceChangeEvent>(OnAppearanceChange);
}
private void OnAppearanceChange(Entity<RandomIconSmoothComponent> ent, ref AppearanceChangeEvent args)
{
if (!TryComp<IconSmoothComponent>(ent, out var smooth))
return;
if (!_appearance.TryGetData<string>(ent, RandomIconSmoothState.State, out var state, args.Component))
return;
smooth.StateBase = state;
_iconSmooth.SetStateBase(ent, smooth, state);
}
}