mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-10-09 18:31:17 +03:00
* 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
29 lines
937 B
C#
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);
|
|
}
|
|
}
|