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:
29
Content.Client/IconSmoothing/ClientRandomIconSmoothSystem.cs
Normal file
29
Content.Client/IconSmoothing/ClientRandomIconSmoothSystem.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Content.Shared.IconSmoothing;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.IconSmoothing;
|
||||
|
||||
public sealed class ClientRandomIconSmoothSystem : SharedRandomIconSmoothSystem
|
||||
{
|
||||
[Dependency] private readonly IconSmoothSystem _iconSmooth = default!;
|
||||
[Dependency] private readonly 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user