ECS Buckle and Rotation visualizers (#13024)

Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
AJCM-git
2022-12-15 14:39:34 -04:00
committed by GitHub
parent eb18363bd2
commit 2af8ada799
7 changed files with 113 additions and 151 deletions

View 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);
}
}