Cleanup redundant SpriteSystem dependencies in VisualizerSystems (#37758)

Cleanup redundant SpriteSystem dependencies in VisualizerSystems
This commit is contained in:
Tayrtahn
2025-05-23 14:12:20 -04:00
committed by GitHub
parent f3f655a8f9
commit bd6645b021
29 changed files with 193 additions and 239 deletions

View File

@@ -5,8 +5,6 @@ namespace Content.Client.Storage.Visualizers;
public sealed class EntityStorageVisualizerSystem : VisualizerSystem<EntityStorageVisualsComponent>
{
[Dependency] private readonly SpriteSystem _sprite = default!;
public override void Initialize()
{
base.Initialize();
@@ -25,7 +23,7 @@ public sealed class EntityStorageVisualizerSystem : VisualizerSystem<EntityStora
if (!TryComp<SpriteComponent>(uid, out var sprite))
return;
_sprite.LayerSetRsiState((uid, sprite), StorageVisualLayers.Base, comp.StateBaseClosed);
SpriteSystem.LayerSetRsiState((uid, sprite), StorageVisualLayers.Base, comp.StateBaseClosed);
}
protected override void OnAppearanceChange(EntityUid uid, EntityStorageVisualsComponent comp, ref AppearanceChangeEvent args)
@@ -35,41 +33,41 @@ public sealed class EntityStorageVisualizerSystem : VisualizerSystem<EntityStora
return;
// Open/Closed state for the storage entity.
if (_sprite.LayerMapTryGet((uid, args.Sprite), StorageVisualLayers.Door, out _, false))
if (SpriteSystem.LayerMapTryGet((uid, args.Sprite), StorageVisualLayers.Door, out _, false))
{
if (open)
{
if (comp.OpenDrawDepth != null)
_sprite.SetDrawDepth((uid, args.Sprite), comp.OpenDrawDepth.Value);
SpriteSystem.SetDrawDepth((uid, args.Sprite), comp.OpenDrawDepth.Value);
if (comp.StateDoorOpen != null)
{
_sprite.LayerSetRsiState((uid, args.Sprite), StorageVisualLayers.Door, comp.StateDoorOpen);
_sprite.LayerSetVisible((uid, args.Sprite), StorageVisualLayers.Door, true);
SpriteSystem.LayerSetRsiState((uid, args.Sprite), StorageVisualLayers.Door, comp.StateDoorOpen);
SpriteSystem.LayerSetVisible((uid, args.Sprite), StorageVisualLayers.Door, true);
}
else
{
_sprite.LayerSetVisible((uid, args.Sprite), StorageVisualLayers.Door, false);
SpriteSystem.LayerSetVisible((uid, args.Sprite), StorageVisualLayers.Door, false);
}
if (comp.StateBaseOpen != null)
_sprite.LayerSetRsiState((uid, args.Sprite), StorageVisualLayers.Base, comp.StateBaseOpen);
SpriteSystem.LayerSetRsiState((uid, args.Sprite), StorageVisualLayers.Base, comp.StateBaseOpen);
}
else
{
if (comp.ClosedDrawDepth != null)
_sprite.SetDrawDepth((uid, args.Sprite), comp.ClosedDrawDepth.Value);
SpriteSystem.SetDrawDepth((uid, args.Sprite), comp.ClosedDrawDepth.Value);
if (comp.StateDoorClosed != null)
{
_sprite.LayerSetRsiState((uid, args.Sprite), StorageVisualLayers.Door, comp.StateDoorClosed);
_sprite.LayerSetVisible((uid, args.Sprite), StorageVisualLayers.Door, true);
SpriteSystem.LayerSetRsiState((uid, args.Sprite), StorageVisualLayers.Door, comp.StateDoorClosed);
SpriteSystem.LayerSetVisible((uid, args.Sprite), StorageVisualLayers.Door, true);
}
else
_sprite.LayerSetVisible((uid, args.Sprite), StorageVisualLayers.Door, false);
SpriteSystem.LayerSetVisible((uid, args.Sprite), StorageVisualLayers.Door, false);
if (comp.StateBaseClosed != null)
_sprite.LayerSetRsiState((uid, args.Sprite), StorageVisualLayers.Base, comp.StateBaseClosed);
SpriteSystem.LayerSetRsiState((uid, args.Sprite), StorageVisualLayers.Base, comp.StateBaseClosed);
}
}
}