diff --git a/Content.Client/GameObjects/Components/StackVisualizer.cs b/Content.Client/GameObjects/Components/StackVisualizer.cs index 01d2a62eaa..8b791cb2aa 100644 --- a/Content.Client/GameObjects/Components/StackVisualizer.cs +++ b/Content.Client/GameObjects/Components/StackVisualizer.cs @@ -15,7 +15,7 @@ namespace Content.Client.GameObjects.Components /// Visualizer for items that come in stacks and have different appearance /// depending on the size of the stack. Visualizer can work by switching between different /// icons in _spriteLayers or if the sprite layers are supposed to be composed as transparent layers. - /// The former behavior is default and the latter behavior can be defined in prototypes. + /// The former behavior is default and the latter behavior can be defined in prototypes. /// /// /// To define a Stack Visualizer prototype insert the following @@ -72,7 +72,7 @@ namespace Content.Client.GameObjects.Components /// true: they are transparent and thus layered one over another in ascending order first /// /// - /// + /// /// private bool _isComposite; private ResourcePath? _spritePath; @@ -108,13 +108,12 @@ namespace Content.Client.GameObjects.Components && _spriteLayers.Count > 0 && entity.TryGetComponent(out var spriteComponent)) { - _spritePath ??= spriteComponent.BaseRSI!.Path!; + var spritePath = _spritePath ?? spriteComponent.BaseRSI!.Path!; foreach (var sprite in _spriteLayers) { - var rsiPath = _spritePath; spriteComponent.LayerMapReserveBlank(sprite); - spriteComponent.LayerSetSprite(sprite, new SpriteSpecifier.Rsi(rsiPath, sprite)); + spriteComponent.LayerSetSprite(sprite, new SpriteSpecifier.Rsi(spritePath, sprite)); spriteComponent.LayerSetVisible(sprite, false); } }