6
StarHorizon_Public/Content.Client/Botany/PotencyVisualsSystem.cs
2026-01-18 12:53:36 +03:00

22 lines
760 B
C#

using System.Numerics;
using Content.Shared.Botany;
using Content.Client.Botany.Components;
using Robust.Client.GameObjects;
namespace Content.Client.Botany;
public sealed class PotencyVisualsSystem : VisualizerSystem<PotencyVisualsComponent>
{
protected override void OnAppearanceChange(EntityUid uid, PotencyVisualsComponent component, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;
if (AppearanceSystem.TryGetData<float>(uid, ProduceVisuals.Potency, out var potency, args.Component))
{
var scale = MathHelper.Lerp(component.MinimumScale, component.MaximumScale, potency / 100);
SpriteSystem.SetScale((uid, args.Sprite), new Vector2(scale, scale));
}
}
}