Files
tbd-station-14/Content.Client/Botany/PotencyVisualsSystem.cs
Steven K 68a5fcb7f8 PlantHolderVisualizer component system refactor (#10091)
* Converted PlantHolderVisualizer to component and system.

* Cleaned up Botany folder.

* Converted initialization of HydroTrayVisualizer under PlantHolderVisualizerSystem to it's own GenericVisualizer.

* Cleaned up hydro_tray.yml.
2022-07-30 19:18:49 -07:00

21 lines
686 B
C#

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