Resolves SmokeVisualizer is Obsolete (#13881)

This commit is contained in:
TemporalOroboros
2023-02-03 11:43:53 -08:00
committed by GitHub
parent 0edbc21ce8
commit a8fd975edd
4 changed files with 33 additions and 30 deletions

View File

@@ -0,0 +1,22 @@
using Content.Shared.Smoking;
using Robust.Client.GameObjects;
namespace Content.Client.Chemistry.Visualizers;
/// <summary>
/// Ensures entities with <see cref="SmokeVisualsComponent"/> have a color corresponding with their contained reagents.
/// </summary>
public sealed class SmokeVisualizerSystem : VisualizerSystem<SmokeVisualsComponent>
{
/// <summary>
/// Syncs the color of the smoke with the color of its contained reagents.
/// </summary>
protected override void OnAppearanceChange(EntityUid uid, SmokeVisualsComponent comp, ref AppearanceChangeEvent args)
{
if (args.Sprite == null)
return;
if(!AppearanceSystem.TryGetData<Color>(uid, SmokeVisuals.Color, out var color))
return;
args.Sprite.Color = color;
}
}