Visualizer systems update (#8203)

* optimize appearance updating for subfloor entities

* sprite event args

* a

* stop double appearance update.
This commit is contained in:
Leon Friedrich
2022-05-16 14:41:23 +10:00
committed by GitHub
parent 920b4e5689
commit 25b9e048e5
22 changed files with 135 additions and 112 deletions

View File

@@ -1,4 +1,4 @@
using Content.Shared.Botany;
using Content.Shared.Botany;
using Robust.Client.GameObjects;
namespace Content.Client.Botany;
@@ -7,15 +7,13 @@ public sealed class PotencyVisualsSystem : VisualizerSystem<PotencyVisualsCompon
{
protected override void OnAppearanceChange(EntityUid uid, PotencyVisualsComponent component, ref AppearanceChangeEvent args)
{
base.OnAppearanceChange(uid, component, ref args);
if (!TryComp<SpriteComponent>(uid, out var sprite))
if (args.Sprite == null)
return;
if (args.Component.TryGetData(ProduceVisuals.Potency, out float potency))
{
var scale = MathHelper.Lerp(component.MinimumScale, component.MaximumScale, potency / 100);
sprite.Scale = new Vector2(scale, scale);
args.Sprite.Scale = new Vector2(scale, scale);
}
}
}