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

@@ -2,6 +2,7 @@ using Content.Client.SubFloor;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping;
using Content.Shared.SubFloor;
using JetBrains.Annotations;
using Robust.Client.GameObjects;
using Robust.Client.ResourceManagement;
@@ -48,6 +49,16 @@ public sealed class AtmosPipeAppearanceSystem : EntitySystem
if (!TryComp(uid, out SpriteComponent? sprite))
return;
if (args.Component.TryGetData(SubFloorVisuals.Covered, out bool isUnderCover)
&& isUnderCover
&& args.Component.TryGetData(SubFloorVisuals.ScannerRevealed, out bool revealed)
&& !revealed)
{
// This entity is below a floor and is not even visible to the user -> don't bother updating sprite data.
// Note that if the subfloor visuals change, then another AppearanceChangeEvent will get triggered.
return;
}
if (!args.Component.TryGetData(PipeColorVisuals.Color, out Color color))
color = Color.White;