Files
ss14-wl/Content.Server/IconSmoothing/RandomIconSmoothSystem.cs
Pieter-Jan BriersandGitHub 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

27 lines
779 B
C#

using Content.Shared.IconSmoothing;
using Robust.Shared.Random;
namespace Content.Server.IconSmoothing;
public sealed partial class RandomIconSmoothSystem : SharedRandomIconSmoothSystem
{
[Dependency] private IRobustRandom _random = default!;
[Dependency] private SharedAppearanceSystem _appearance = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<RandomIconSmoothComponent, MapInitEvent>(OnMapInit);
}
private void OnMapInit(Entity<RandomIconSmoothComponent> ent, ref MapInitEvent args)
{
if (ent.Comp.RandomStates.Count == 0)
return;
var state = _random.Pick(ent.Comp.RandomStates);
_appearance.SetData(ent, RandomIconSmoothState.State, state);
}
}