Files
tbd-station-14/Content.Client/Botany/PotencyVisualsSystem.cs
Leon Friedrich 25b9e048e5 Visualizer systems update (#8203)
* optimize appearance updating for subfloor entities

* sprite event args

* a

* stop double appearance update.
2022-05-16 14:41:23 +10:00

20 lines
646 B
C#

using Content.Shared.Botany;
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 (args.Component.TryGetData(ProduceVisuals.Potency, out float potency))
{
var scale = MathHelper.Lerp(component.MinimumScale, component.MaximumScale, potency / 100);
args.Sprite.Scale = new Vector2(scale, scale);
}
}
}