ECS Buckle and Rotation visualizers (#13024)
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
23
Content.Client/Buckle/BuckleVisualizerSystem.cs
Normal file
23
Content.Client/Buckle/BuckleVisualizerSystem.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Content.Shared.Buckle.Components;
|
||||
using Content.Client.Rotation;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.Buckle;
|
||||
|
||||
public sealed class BuckleVisualizer : VisualizerSystem<BuckleComponent>
|
||||
{
|
||||
protected override void OnAppearanceChange(EntityUid uid, BuckleComponent component, ref AppearanceChangeEvent args)
|
||||
{
|
||||
if (!args.Component.TryGetData<int>(StrapVisuals.RotationAngle, out var angle) ||
|
||||
!args.Component.TryGetData<bool>(BuckleVisuals.Buckled, out var buckled) ||
|
||||
!buckled ||
|
||||
args.Sprite == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EntityManager.System<RotationVisualizerSystem>()
|
||||
.AnimateSpriteRotation(args.Sprite, Angle.FromDegrees(angle), 0.125f);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user