randomize iconSmoothing (#28158)
* randomize iconSmoothing * Revert "randomize iconSmoothing" This reverts commit 094356f975737c0af24ce39d849aec7852b9af6e. * try 2 * trying work with client-server communication * still dont work * Tayrtahn good suggestion * remove outdated code * Fix! * move data to Appearance * Update RandomIconSmoothComponent.cs
This commit is contained in:
26
Content.Server/IconSmoothing/RandomIconSmoothSystem.cs
Normal file
26
Content.Server/IconSmoothing/RandomIconSmoothSystem.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using Content.Shared.IconSmoothing;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.IconSmoothing;
|
||||
|
||||
public sealed partial class RandomIconSmoothSystem : SharedRandomIconSmoothSystem
|
||||
{
|
||||
[Dependency] private readonly IRobustRandom _random = default!;
|
||||
[Dependency] private readonly 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user