2022-05-16 14:41:23 +10:00
|
|
|
using Content.Shared.Botany;
|
2022-03-13 03:11:03 -07:00
|
|
|
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)
|
|
|
|
|
{
|
2022-05-16 14:41:23 +10:00
|
|
|
if (args.Sprite == null)
|
2022-03-13 03:11:03 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (args.Component.TryGetData(ProduceVisuals.Potency, out float potency))
|
|
|
|
|
{
|
|
|
|
|
var scale = MathHelper.Lerp(component.MinimumScale, component.MaximumScale, potency / 100);
|
2022-05-16 14:41:23 +10:00
|
|
|
args.Sprite.Scale = new Vector2(scale, scale);
|
2022-03-13 03:11:03 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|