]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup more `SpriteComponent` warnings (part 2) (#37527)
authorTayrtahn <tayrtahn@gmail.com>
Sat, 17 May 2025 03:29:03 +0000 (23:29 -0400)
committerGitHub <noreply@github.com>
Sat, 17 May 2025 03:29:03 +0000 (13:29 +1000)
* Cleanup warnings in MagazineVisualsSpriteTest

* Cleanup warnings in WiresVisualizerSystem

* Cleanup warnings in GunSystem.SpentAmmo

* Cleanup warnings in GunSystem

* Cleanup warnings in GunSystem.ChamberMagazine

* Cleanup warnings in MeleeWeaponSystem.Effects

* Cleanup warnings in ToggleableLightVisualsSystem

* Cleanup warnings in StatusIconOverlay

* Cleanup warnings in SpriteFadeSystem

* Cleanup warnings in PdaVisualizerSystem

* Cleanup warnings in EnvelopeSystem

* Cleanup warnings in MechSystem

* Cleanup warnings in MappingOverlay

* Cleanup warnings in LockVisualizerSystem

* Cleanup warnings in DragDropSystem

* Cleanup warnings in GhostSystem

* Cleanup warnings in TriggerSystem.Proximity

* Cleanup warnings in DragonSystem

* Cleanup warnings in PortableScrubberVisualsSystem

* File-scoped namespace for PortableScrubberVisualsSystem

20 files changed:
Content.Client/Atmos/Visualizers/PortableScrubberVisualsSystem.cs
Content.Client/Dragon/DragonSystem.cs
Content.Client/Explosion/TriggerSystem.Proximity.cs
Content.Client/Ghost/GhostSystem.cs
Content.Client/Interaction/DragDropSystem.cs
Content.Client/Lock/Visualizers/LockVisualizerSystem.cs
Content.Client/Mapping/MappingOverlay.cs
Content.Client/Mech/MechSystem.cs
Content.Client/PDA/PdaVisualizerSystem.cs
Content.Client/Paper/EnvelopeSystem.cs
Content.Client/Sprite/SpriteFadeSystem.cs
Content.Client/StatusIcon/StatusIconOverlay.cs
Content.Client/Toggleable/ToggleableLightVisualsSystem.cs
Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs
Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.ChamberMagazine.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.SpentAmmo.cs
Content.Client/Weapons/Ranged/Systems/GunSystem.cs
Content.Client/Wires/Visualizers/WiresVisualizerSystem.cs
Content.IntegrationTests/Tests/MagazineVisualsSpriteTest.cs

index 262c854a47ba10352cad222c2b27c19b83f47c0d..1df9859a9089f244dcaf919cbaf99afd9d05d67e 100644 (file)
@@ -2,35 +2,37 @@ using Robust.Client.GameObjects;
 using Content.Shared.Atmos.Visuals;
 using Content.Client.Power;
 
-namespace Content.Client.Atmos.Visualizers
+namespace Content.Client.Atmos.Visualizers;
+
+/// <summary>
+/// Controls client-side visuals for portable scrubbers.
+/// </summary>
+public sealed class PortableScrubberSystem : VisualizerSystem<PortableScrubberVisualsComponent>
 {
-    /// <summary>
-    /// Controls client-side visuals for portable scrubbers.
-    /// </summary>
-    public sealed class PortableScrubberSystem : VisualizerSystem<PortableScrubberVisualsComponent>
+    [Dependency] private readonly SpriteSystem _sprite = default!;
+
+    protected override void OnAppearanceChange(EntityUid uid, PortableScrubberVisualsComponent component, ref AppearanceChangeEvent args)
     {
-        protected override void OnAppearanceChange(EntityUid uid, PortableScrubberVisualsComponent component, ref AppearanceChangeEvent args)
+        if (args.Sprite == null)
+            return;
+
+        if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsFull, out var isFull, args.Component)
+            && AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsRunning, out var isRunning, args.Component))
+        {
+            var runningState = isRunning ? component.RunningState : component.IdleState;
+            _sprite.LayerSetRsiState((uid, args.Sprite), PortableScrubberVisualLayers.IsRunning, runningState);
+
+            var fullState = isFull ? component.FullState : component.ReadyState;
+            _sprite.LayerSetRsiState((uid, args.Sprite), PowerDeviceVisualLayers.Powered, fullState);
+        }
+
+        if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsDraining, out var isDraining, args.Component))
         {
-            if (args.Sprite == null)
-                return;
-
-            if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsFull, out var isFull, args.Component)
-                && AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsRunning, out var isRunning, args.Component))
-            {
-                var runningState = isRunning ? component.RunningState : component.IdleState;
-                args.Sprite.LayerSetState(PortableScrubberVisualLayers.IsRunning, runningState);
-
-                var fullState = isFull ? component.FullState : component.ReadyState;
-                args.Sprite.LayerSetState(PowerDeviceVisualLayers.Powered, fullState);
-            }
-
-            if (AppearanceSystem.TryGetData<bool>(uid, PortableScrubberVisuals.IsDraining, out var isDraining, args.Component))
-            {
-                args.Sprite.LayerSetVisible(PortableScrubberVisualLayers.IsDraining, isDraining);
-            }
+            _sprite.LayerSetVisible((uid, args.Sprite), PortableScrubberVisualLayers.IsDraining, isDraining);
         }
     }
 }
+
 public enum PortableScrubberVisualLayers : byte
 {
     IsRunning,
index e164798c1eb4becb3b5e9c45eaa3d61c08395c46..5a3b346458d1219e5099523a2782fa30522f7188 100644 (file)
@@ -7,6 +7,7 @@ namespace Content.Client.Dragon;
 public sealed class DragonSystem : EntitySystem
 {
     [Dependency] private readonly SharedPointLightSystem _lights = default!;
+    [Dependency] private readonly SpriteSystem _sprite = default!;
 
     public override void Initialize()
     {
@@ -31,7 +32,7 @@ public sealed class DragonSystem : EntitySystem
         switch (state.State)
         {
             case DragonRiftState.Charging:
-                sprite?.LayerSetColor(0, Color.FromHex("#569fff"));
+                _sprite.LayerSetColor((uid, sprite), 0, Color.FromHex("#569fff"));
 
                 if (light != null)
                 {
@@ -39,7 +40,7 @@ public sealed class DragonSystem : EntitySystem
                 }
                 break;
             case DragonRiftState.AlmostFinished:
-                sprite?.LayerSetColor(0, Color.FromHex("#cf4cff"));
+                _sprite.LayerSetColor((uid, sprite), 0, Color.FromHex("#cf4cff"));
 
                 if (light != null)
                 {
@@ -47,7 +48,7 @@ public sealed class DragonSystem : EntitySystem
                 }
                 break;
             case DragonRiftState.Finished:
-                sprite?.LayerSetColor(0, Color.FromHex("#edbc36"));
+                _sprite.LayerSetColor((uid, sprite), 0, Color.FromHex("#edbc36"));
 
                 if (light != null)
                 {
index 8f3ab86a70d1368055ea2a084c37c3e286edd959..d49f483664ed06449dd009e7b67c7888d4044b9a 100644 (file)
@@ -9,6 +9,7 @@ public sealed partial class TriggerSystem
 {
     [Dependency] private readonly AnimationPlayerSystem _player = default!;
     [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+    [Dependency] private readonly SpriteSystem _sprite = default!;
 
     /*
      * Currently all of the appearance stuff is hardcoded for portable flashers
@@ -79,7 +80,7 @@ public sealed partial class TriggerSystem
         if (!_appearance.TryGetData<ProximityTriggerVisuals>(uid, ProximityTriggerVisualState.State, out var state, appearance))
             return;
 
-        if (!spriteComponent.LayerMapTryGet(ProximityTriggerVisualLayers.Base, out var layer))
+        if (!_sprite.LayerMapTryGet((uid, spriteComponent), ProximityTriggerVisualLayers.Base, out var layer, false))
             // Don't do anything if the sprite doesn't have the layer.
             return;
 
@@ -89,7 +90,7 @@ public sealed partial class TriggerSystem
                 // Don't interrupt the flash animation
                 if (_player.HasRunningAnimation(uid, player, AnimKey)) return;
                 _player.Stop(uid, player, AnimKey);
-                spriteComponent.LayerSetState(layer, "on");
+                _sprite.LayerSetRsiState((uid, spriteComponent), layer, "on");
                 break;
             case ProximityTriggerVisuals.Active:
                 if (_player.HasRunningAnimation(uid, player, AnimKey)) return;
@@ -98,7 +99,7 @@ public sealed partial class TriggerSystem
             case ProximityTriggerVisuals.Off:
             default:
                 _player.Stop(uid, player, AnimKey);
-                spriteComponent.LayerSetState(layer, "off");
+                _sprite.LayerSetRsiState((uid, spriteComponent), layer, "off");
                 break;
         }
     }
index 180127bb10e682bb1ae4512e2446d17dc7d219cc..58758f54f24de790abd9c315b4c1a93aeda19322 100644 (file)
@@ -15,6 +15,7 @@ namespace Content.Client.Ghost
         [Dependency] private readonly SharedActionsSystem _actions = default!;
         [Dependency] private readonly PointLightSystem _pointLightSystem = default!;
         [Dependency] private readonly ContentEyeSystem _contentEye = default!;
+        [Dependency] private readonly SpriteSystem _sprite = default!;
 
         public int AvailableGhostRoleCount { get; private set; }
 
@@ -35,7 +36,7 @@ namespace Content.Client.Ghost
                 var query = AllEntityQuery<GhostComponent, SpriteComponent>();
                 while (query.MoveNext(out var uid, out _, out var sprite))
                 {
-                    sprite.Visible = value || uid == _playerManager.LocalEntity;
+                    _sprite.SetVisible((uid, sprite), value || uid == _playerManager.LocalEntity);
                 }
             }
         }
@@ -72,7 +73,7 @@ namespace Content.Client.Ghost
         private void OnStartup(EntityUid uid, GhostComponent component, ComponentStartup args)
         {
             if (TryComp(uid, out SpriteComponent? sprite))
-                sprite.Visible = GhostVisibility || uid == _playerManager.LocalEntity;
+                _sprite.SetVisible((uid, sprite), GhostVisibility || uid == _playerManager.LocalEntity);
         }
 
         private void OnToggleLighting(EntityUid uid, EyeComponent component, ToggleLightingActionEvent args)
@@ -150,7 +151,7 @@ namespace Content.Client.Ghost
         private void OnGhostState(EntityUid uid, GhostComponent component, ref AfterAutoHandleStateEvent args)
         {
             if (TryComp<SpriteComponent>(uid, out var sprite))
-                sprite.LayerSetColor(0, component.Color);
+                _sprite.LayerSetColor((uid, sprite), 0, component.Color);
 
             if (uid != _playerManager.LocalEntity)
                 return;
index 969aaffe0722875ece82ddf0c9b38914539a5f21..fe2386653521da1b7faa3e1781748571ab14f7c8 100644 (file)
@@ -43,6 +43,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
     [Dependency] private readonly EntityLookupSystem _lookup = default!;
     [Dependency] private readonly SharedPopupSystem _popup = default!;
     [Dependency] private readonly SharedTransformSystem _transformSystem = default!;
+    [Dependency] private readonly SpriteSystem _sprite = default!;
 
     // how often to recheck possible targets (prevents calling expensive
     // check logic each update)
@@ -178,7 +179,7 @@ public sealed class DragDropSystem : SharedDragDropSystem
 
     private bool OnUseMouseDown(in PointerInputCmdHandler.PointerInputCmdArgs args)
     {
-        if (args.Session?.AttachedEntity is not {Valid: true} dragger ||
+        if (args.Session?.AttachedEntity is not { Valid: true } dragger ||
             _combatMode.IsInCombatMode())
         {
             return false;
@@ -249,11 +250,11 @@ public sealed class DragDropSystem : SharedDragDropSystem
             var mousePos = _eyeManager.PixelToMap(screenPos);
             _dragShadow = EntityManager.SpawnEntity("dragshadow", mousePos);
             var dragSprite = Comp<SpriteComponent>(_dragShadow.Value);
-            dragSprite.CopyFrom(draggedSprite);
+            _sprite.CopySprite((_draggedEntity.Value, draggedSprite), (_dragShadow.Value, dragSprite));
             dragSprite.RenderOrder = EntityManager.CurrentTick.Value;
-            dragSprite.Color = dragSprite.Color.WithAlpha(0.7f);
+            _sprite.SetColor((_dragShadow.Value, dragSprite), dragSprite.Color.WithAlpha(0.7f));
             // keep it on top of everything
-            dragSprite.DrawDepth = (int) DrawDepth.Overlays;
+            _sprite.SetDrawDepth((_dragShadow.Value, dragSprite), (int)DrawDepth.Overlays);
             if (!dragSprite.NoRotation)
             {
                 _transformSystem.SetWorldRotationNoLerp(_dragShadow.Value, _transformSystem.GetWorldRotation(_draggedEntity.Value));
index 1329a69ad256fb9e0decda70a24310c3ce7bb7bb..76385ffd90b80e6a2942951f0e64e7b95e670ca6 100644 (file)
@@ -6,6 +6,8 @@ namespace Content.Client.Lock.Visualizers;
 
 public sealed class LockVisualizerSystem : VisualizerSystem<LockVisualsComponent>
 {
+    [Dependency] private readonly SpriteSystem _sprite = default!;
+
     protected override void OnAppearanceChange(EntityUid uid, LockVisualsComponent comp, ref AppearanceChangeEvent args)
     {
         if (args.Sprite == null
@@ -20,14 +22,14 @@ public sealed class LockVisualizerSystem : VisualizerSystem<LockVisualsComponent
 
         if (AppearanceSystem.TryGetData<bool>(uid, StorageVisuals.Open, out var open, args.Component))
         {
-            args.Sprite.LayerSetVisible(LockVisualLayers.Lock, !open);
+            _sprite.LayerSetVisible((uid, args.Sprite), LockVisualLayers.Lock, !open);
         }
-        else if (!(bool) unlockedStateExist!)
-            args.Sprite.LayerSetVisible(LockVisualLayers.Lock, locked);
+        else if (!(bool)unlockedStateExist!)
+            _sprite.LayerSetVisible((uid, args.Sprite), LockVisualLayers.Lock, locked);
 
-        if (!open && (bool) unlockedStateExist!)
+        if (!open && (bool)unlockedStateExist!)
         {
-            args.Sprite.LayerSetState(LockVisualLayers.Lock, locked ? comp.StateLocked : comp.StateUnlocked);
+            _sprite.LayerSetRsiState((uid, args.Sprite), LockVisualLayers.Lock, locked ? comp.StateLocked : comp.StateUnlocked);
         }
     }
 }
index ef9f3e795e6fa50883aecc03a06570d8e38c2b6c..ed44b43d5250bc9cc4fc01b83aecc57bc46fa24c 100644 (file)
@@ -15,6 +15,8 @@ public sealed class MappingOverlay : Overlay
     [Dependency] private readonly IPlayerManager _player = default!;
     [Dependency] private readonly IPrototypeManager _prototypes = default!;
 
+    private readonly SpriteSystem _sprite;
+
     // 1 off in case something else uses these colors since we use them to compare
     private static readonly Color PickColor = new(1, 255, 0);
     private static readonly Color DeleteColor = new(255, 1, 0);
@@ -30,6 +32,8 @@ public sealed class MappingOverlay : Overlay
     {
         IoCManager.InjectDependencies(this);
 
+        _sprite = _entities.System<SpriteSystem>();
+
         _state = state;
         _shader = _prototypes.Index<ShaderPrototype>("unshaded").Instance();
     }
@@ -42,7 +46,7 @@ public sealed class MappingOverlay : Overlay
                 continue;
 
             if (sprite.Color == DeleteColor || sprite.Color == PickColor)
-                sprite.Color = color;
+                _sprite.SetColor((id, sprite), color);
         }
 
         _oldColors.Clear();
@@ -61,7 +65,7 @@ public sealed class MappingOverlay : Overlay
                     _entities.TryGetComponent(entity, out SpriteComponent? sprite))
                 {
                     _oldColors[entity] = sprite.Color;
-                    sprite.Color = PickColor;
+                    _sprite.SetColor((entity, sprite), PickColor);
                 }
 
                 break;
@@ -72,7 +76,7 @@ public sealed class MappingOverlay : Overlay
                     _entities.TryGetComponent(entity, out SpriteComponent? sprite))
                 {
                     _oldColors[entity] = sprite.Color;
-                    sprite.Color = DeleteColor;
+                    _sprite.SetColor((entity, sprite), DeleteColor);
                 }
 
                 break;
index ba4e29951d140d8913ce62846b49d5a3bf01c2e9..816342ad95fdd2931be6213d4ae03b9dbd2c3d6c 100644 (file)
@@ -10,6 +10,7 @@ namespace Content.Client.Mech;
 public sealed class MechSystem : SharedMechSystem
 {
     [Dependency] private readonly SharedAppearanceSystem _appearance = default!;
+    [Dependency] private readonly SpriteSystem _sprite = default!;
 
     /// <inheritdoc/>
     public override void Initialize()
@@ -24,7 +25,7 @@ public sealed class MechSystem : SharedMechSystem
         if (args.Sprite == null)
             return;
 
-        if (!args.Sprite.TryGetLayer((int) MechVisualLayers.Base, out var layer))
+        if (!_sprite.LayerExists((uid, args.Sprite), MechVisualLayers.Base))
             return;
 
         var state = component.BaseState;
@@ -40,7 +41,7 @@ public sealed class MechSystem : SharedMechSystem
             drawDepth = DrawDepth.SmallMobs;
         }
 
-        layer.SetState(state);
-        args.Sprite.DrawDepth = (int) drawDepth;
+        _sprite.LayerSetRsiState((uid, args.Sprite), MechVisualLayers.Base, state);
+        _sprite.SetDrawDepth((uid, args.Sprite), (int)drawDepth);
     }
 }
index 735fcd42eb0d0750c98cebd04fc770d54e270646..1c132de586defe65d06b3331399b06eec0f4e501 100644 (file)
@@ -6,19 +6,20 @@ namespace Content.Client.PDA;
 
 public sealed class PdaVisualizerSystem : VisualizerSystem<PdaVisualsComponent>
 {
+    [Dependency] private readonly SpriteSystem _sprite = default!;
     protected override void OnAppearanceChange(EntityUid uid, PdaVisualsComponent comp, ref AppearanceChangeEvent args)
     {
         if (args.Sprite == null)
             return;
 
         if (AppearanceSystem.TryGetData<string>(uid, PdaVisuals.PdaType, out var pdaType, args.Component))
-            args.Sprite.LayerSetState(PdaVisualLayers.Base, pdaType);
+            _sprite.LayerSetRsiState((uid, args.Sprite), PdaVisualLayers.Base, pdaType);
 
         if (AppearanceSystem.TryGetData<bool>(uid, UnpoweredFlashlightVisuals.LightOn, out var isFlashlightOn, args.Component))
-            args.Sprite.LayerSetVisible(PdaVisualLayers.Flashlight, isFlashlightOn);
+            _sprite.LayerSetVisible((uid, args.Sprite), PdaVisualLayers.Flashlight, isFlashlightOn);
 
         if (AppearanceSystem.TryGetData<bool>(uid, PdaVisuals.IdCardInserted, out var isCardInserted, args.Component))
-            args.Sprite.LayerSetVisible(PdaVisualLayers.IdLight, isCardInserted);
+            _sprite.LayerSetVisible((uid, args.Sprite), PdaVisualLayers.IdLight, isCardInserted);
     }
 
     public enum PdaVisualLayers : byte
index f405ed1518889fd7444bfb9005af5727a5e53c9f..49bd36349c3fc9aa246345c2cd2799b3937a948c 100644 (file)
@@ -5,6 +5,8 @@ namespace Content.Client.Paper;
 
 public sealed class EnvelopeSystem : VisualizerSystem<EnvelopeComponent>
 {
+    [Dependency] private readonly SpriteSystem _sprite = default!;
+
     public override void Initialize()
     {
         base.Initialize();
@@ -21,9 +23,9 @@ public sealed class EnvelopeSystem : VisualizerSystem<EnvelopeComponent>
         if (!Resolve(ent.Owner, ref sprite))
             return;
 
-        sprite.LayerSetVisible(EnvelopeVisualLayers.Open, ent.Comp.State == EnvelopeComponent.EnvelopeState.Open);
-        sprite.LayerSetVisible(EnvelopeVisualLayers.Sealed, ent.Comp.State == EnvelopeComponent.EnvelopeState.Sealed);
-        sprite.LayerSetVisible(EnvelopeVisualLayers.Torn, ent.Comp.State == EnvelopeComponent.EnvelopeState.Torn);
+        _sprite.LayerSetVisible((ent.Owner, sprite), EnvelopeVisualLayers.Open, ent.Comp.State == EnvelopeComponent.EnvelopeState.Open);
+        _sprite.LayerSetVisible((ent.Owner, sprite), EnvelopeVisualLayers.Sealed, ent.Comp.State == EnvelopeComponent.EnvelopeState.Sealed);
+        _sprite.LayerSetVisible((ent.Owner, sprite), EnvelopeVisualLayers.Torn, ent.Comp.State == EnvelopeComponent.EnvelopeState.Torn);
     }
 
     public enum EnvelopeVisualLayers : byte
index 0a028f596ecd26946bb5df56ef196dacabc47e3a..b34741104091b16c8a573d7c636ee8653a304b42 100644 (file)
@@ -1,4 +1,3 @@
-using System.Numerics;
 using Content.Client.Gameplay;
 using Content.Shared.Sprite;
 using Robust.Client.GameObjects;
@@ -10,7 +9,6 @@ using Robust.Client.UserInterface;
 using Robust.Shared.Map;
 using Robust.Shared.Physics.Systems;
 using Robust.Shared.Physics;
-using Robust.Shared.Physics.Components;
 
 namespace Content.Client.Sprite;
 
@@ -28,6 +26,7 @@ public sealed class SpriteFadeSystem : EntitySystem
     [Dependency] private readonly IUserInterfaceManager _uiManager = default!;
     [Dependency] private readonly IInputManager _inputManager = default!;
     [Dependency] private readonly SharedPhysicsSystem _physics = default!;
+    [Dependency] private readonly SpriteSystem _sprite = default!;
 
     private List<(MapCoordinates Point, bool ExcludeBoundingBox)> _points = new();
 
@@ -58,7 +57,7 @@ public sealed class SpriteFadeSystem : EntitySystem
         if (MetaData(uid).EntityLifeStage >= EntityLifeStage.Terminating || !TryComp<SpriteComponent>(uid, out var sprite))
             return;
 
-        sprite.Color = sprite.Color.WithAlpha(component.OriginalAlpha);
+        _sprite.SetColor((uid, sprite), sprite.Color.WithAlpha(component.OriginalAlpha));
     }
 
     /// <summary>
@@ -132,7 +131,7 @@ public sealed class SpriteFadeSystem : EntitySystem
 
                     if (!sprite.Color.A.Equals(newColor))
                     {
-                        sprite.Color = sprite.Color.WithAlpha(newColor);
+                        _sprite.SetColor((ent, sprite), sprite.Color.WithAlpha(newColor));
                     }
                 }
             }
@@ -157,7 +156,7 @@ public sealed class SpriteFadeSystem : EntitySystem
 
             if (!newColor.Equals(sprite.Color.A))
             {
-                sprite.Color = sprite.Color.WithAlpha(newColor);
+                _sprite.SetColor((uid, sprite), sprite.Color.WithAlpha(newColor));
             }
             else
             {
index 4b3daae22fd84b9c52ca472f19b3603bec6a7d73..32fb2dca77b5c6c572f1c3a9feb9cf547c948fa9 100644 (file)
@@ -48,7 +48,7 @@ public sealed class StatusIconOverlay : Overlay
             if (xform.MapID != args.MapId || !sprite.Visible)
                 continue;
 
-            var bounds = comp.Bounds ?? sprite.Bounds;
+            var bounds = comp.Bounds ?? _sprite.GetLocalBounds((uid, sprite));
 
             var worldPos = _transform.GetWorldPosition(xform, xformQuery);
 
@@ -86,28 +86,28 @@ public sealed class StatusIconOverlay : Overlay
                 if (proto.LocationPreference == StatusIconLocationPreference.Left ||
                     proto.LocationPreference == StatusIconLocationPreference.None && countL <= countR)
                 {
-                    if (accOffsetL + texture.Height > sprite.Bounds.Height * EyeManager.PixelsPerMeter)
+                    if (accOffsetL + texture.Height > _sprite.GetLocalBounds((uid, sprite)).Height * EyeManager.PixelsPerMeter)
                         break;
                     if (proto.Layer == StatusIconLayer.Base)
                     {
                         accOffsetL += texture.Height;
                         countL++;
                     }
-                    yOffset = (bounds.Height + sprite.Offset.Y) / 2f - (float) (accOffsetL - proto.Offset) / EyeManager.PixelsPerMeter;
+                    yOffset = (bounds.Height + sprite.Offset.Y) / 2f - (float)(accOffsetL - proto.Offset) / EyeManager.PixelsPerMeter;
                     xOffset = -(bounds.Width + sprite.Offset.X) / 2f;
 
                 }
                 else
                 {
-                    if (accOffsetR + texture.Height > sprite.Bounds.Height * EyeManager.PixelsPerMeter)
+                    if (accOffsetR + texture.Height > _sprite.GetLocalBounds((uid, sprite)).Height * EyeManager.PixelsPerMeter)
                         break;
                     if (proto.Layer == StatusIconLayer.Base)
                     {
                         accOffsetR += texture.Height;
                         countR++;
                     }
-                    yOffset = (bounds.Height + sprite.Offset.Y) / 2f - (float) (accOffsetR - proto.Offset) / EyeManager.PixelsPerMeter;
-                    xOffset = (bounds.Width + sprite.Offset.X) / 2f - (float) texture.Width / EyeManager.PixelsPerMeter;
+                    yOffset = (bounds.Height + sprite.Offset.Y) / 2f - (float)(accOffsetR - proto.Offset) / EyeManager.PixelsPerMeter;
+                    xOffset = (bounds.Width + sprite.Offset.X) / 2f - (float)texture.Width / EyeManager.PixelsPerMeter;
 
                 }
 
index a3d35ffeedd7168dfdee739a9dc43bb853a49e8d..28144486c30938859990b9f20f84a906354b8065 100644 (file)
@@ -15,6 +15,7 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem<ToggleableLi
 {
     [Dependency] private readonly SharedItemSystem _itemSys = default!;
     [Dependency] private readonly SharedPointLightSystem _lights = default!;
+    [Dependency] private readonly SpriteSystem _sprite = default!;
 
     public override void Initialize()
     {
@@ -31,11 +32,11 @@ public sealed class ToggleableLightVisualsSystem : VisualizerSystem<ToggleableLi
         var modulate = AppearanceSystem.TryGetData<Color>(uid, ToggleableLightVisuals.Color, out var color, args.Component);
 
         // Update the item's sprite
-        if (args.Sprite != null && component.SpriteLayer != null && args.Sprite.LayerMapTryGet(component.SpriteLayer, out var layer))
+        if (args.Sprite != null && component.SpriteLayer != null && _sprite.LayerMapTryGet((uid, args.Sprite), component.SpriteLayer, out var layer, false))
         {
-            args.Sprite.LayerSetVisible(layer, enabled);
+            _sprite.LayerSetVisible((uid, args.Sprite), layer, enabled);
             if (modulate)
-                args.Sprite.LayerSetColor(layer, color);
+                _sprite.LayerSetColor((uid, args.Sprite), layer, color);
         }
 
         // Update any point-lights
index 9e20d2d5a9c7f9d463bb293fca7e42f4fb5908d9..49b5b4a25b00968f75032f997189560b734dd0bf 100644 (file)
@@ -49,14 +49,14 @@ public sealed partial class MeleeWeaponSystem
         {
             if (user != weapon
                 && TryComp(weapon, out SpriteComponent? weaponSpriteComponent))
-                sprite.CopyFrom(weaponSpriteComponent);
+                _sprite.CopySprite((weapon, weaponSpriteComponent), (animationUid, sprite));
 
             spriteRotation = meleeWeaponComponent.WideAnimationRotation;
 
             if (meleeWeaponComponent.SwingLeft)
                 angle *= -1;
         }
-        sprite.Rotation = localPos.ToWorldAngle();
+        _sprite.SetRotation((animationUid, sprite), localPos.ToWorldAngle());
         var distance = Math.Clamp(localPos.Length() / 2f, 0.2f, 1f);
 
         var xform = _xformQuery.GetComponent(animationUid);
@@ -74,7 +74,7 @@ public sealed partial class MeleeWeaponSystem
             case WeaponArcAnimation.Thrust:
                 track = EnsureComp<TrackUserComponent>(animationUid);
                 track.User = user;
-                _animation.Play(animationUid, GetThrustAnimation(sprite, distance, spriteRotation), ThrustAnimationKey);
+                _animation.Play(animationUid, GetThrustAnimation((animationUid, sprite), distance, spriteRotation), ThrustAnimationKey);
                 if (arcComponent.Fadeout)
                     _animation.Play(animationUid, GetFadeAnimation(sprite, 0.05f, 0.15f), FadeAnimationKey);
                 break;
@@ -132,13 +132,13 @@ public sealed partial class MeleeWeaponSystem
         };
     }
 
-    private Animation GetThrustAnimation(SpriteComponent sprite, float distance, Angle spriteRotation)
+    private Animation GetThrustAnimation(Entity<SpriteComponent> sprite, float distance, Angle spriteRotation)
     {
         const float thrustEnd = 0.05f;
         const float length = 0.15f;
-        var startOffset = sprite.Rotation.RotateVec(new Vector2(0f, -distance / 5f));
-        var endOffset = sprite.Rotation.RotateVec(new Vector2(0f, -distance));
-        sprite.Rotation += spriteRotation;
+        var startOffset = sprite.Comp.Rotation.RotateVec(new Vector2(0f, -distance / 5f));
+        var endOffset = sprite.Comp.Rotation.RotateVec(new Vector2(0f, -distance));
+        _sprite.SetRotation(sprite.AsNullable(), sprite.Comp.Rotation + spriteRotation);
 
         return new Animation()
         {
index 826436b88dd5993b60af0eda8c6c9393618253a5..011c4e81d8491bf437c3a7ee32be2379c2b3cd25 100644 (file)
@@ -30,6 +30,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
     [Dependency] private readonly InputSystem _inputSystem = default!;
     [Dependency] private readonly SharedColorFlashEffectSystem _color = default!;
     [Dependency] private readonly MapSystem _map = default!;
+    [Dependency] private readonly SpriteSystem _sprite = default!;
 
     private EntityQuery<TransformComponent> _xformQuery;
 
index 52c2caaa3ad622d9a8776cae563ce6696944e49f..d40708de998097c1670e8aef7ee1474251ac2b6d 100644 (file)
@@ -21,7 +21,7 @@ public sealed partial class GunSystem
     private void OnChamberMagazineAppearance(EntityUid uid, ChamberMagazineAmmoProviderComponent component, ref AppearanceChangeEvent args)
     {
         if (args.Sprite == null ||
-            !args.Sprite.LayerMapTryGet(GunVisualLayers.Base, out var boltLayer) ||
+            !_sprite.LayerMapTryGet((uid, args.Sprite), GunVisualLayers.Base, out var boltLayer, false) ||
             !Appearance.TryGetData(uid, AmmoVisuals.BoltClosed, out bool boltClosed))
         {
             return;
@@ -30,11 +30,11 @@ public sealed partial class GunSystem
         // Maybe re-using base layer for this will bite me someday but screw you future sloth.
         if (boltClosed)
         {
-            args.Sprite.LayerSetState(boltLayer, "base");
+            _sprite.LayerSetRsiState((uid, args.Sprite), boltLayer, "base");
         }
         else
         {
-            args.Sprite.LayerSetState(boltLayer, "bolt-open");
+            _sprite.LayerSetRsiState((uid, args.Sprite), boltLayer, "bolt-open");
         }
     }
 
index adfdc89b897b27dbc351b17a4606a875a9ae4fe4..dc5aa4d08c252b7610352b66eba4b686cc2330c4 100644 (file)
@@ -29,9 +29,7 @@ public sealed partial class GunSystem
         else
             state = component.State;
 
-        sprite.LayerSetState(AmmoVisualLayers.Base, state);
-        if (sprite.LayerExists(AmmoVisualLayers.Tip)){
-            sprite.RemoveLayer(AmmoVisualLayers.Tip);
-        }
+        _sprite.LayerSetRsiState((uid, sprite), AmmoVisualLayers.Base, state);
+        _sprite.RemoveLayer((uid, sprite), AmmoVisualLayers.Tip, false);
     }
 }
index b52fa2b95428363e5a803e5812cc5eebf8429c0d..3c8de7c445c065eccfe43f7f529bc0827d8a0fa3 100644 (file)
@@ -130,9 +130,9 @@ public sealed partial class GunSystem : SharedGunSystem
             _xform.SetLocalRotationNoLerp(ent, xform.LocalRotation + delta, xform);
 
             sprite[EffectLayers.Unshaded].AutoAnimated = false;
-            sprite.LayerSetSprite(EffectLayers.Unshaded, rsi);
-            sprite.LayerSetState(EffectLayers.Unshaded, rsi.RsiState);
-            sprite.Scale = new Vector2(a.Distance, 1f);
+            _sprite.LayerSetSprite((ent, sprite), EffectLayers.Unshaded, rsi);
+            _sprite.LayerSetRsiState((ent, sprite), EffectLayers.Unshaded, rsi.RsiState);
+            _sprite.SetScale((ent, sprite), new Vector2(a.Distance, 1f));
             sprite[EffectLayers.Unshaded].Visible = true;
 
             var anim = new Animation()
index ffc8b09a1a2fa3ac1b6940115d012dfce3ac48d0..e107dd220af77ef515bc7427bcd9655372a783a1 100644 (file)
@@ -5,22 +5,24 @@ namespace Content.Client.Wires.Visualizers
 {
     public sealed class WiresVisualizerSystem : VisualizerSystem<WiresVisualsComponent>
     {
+        [Dependency] private readonly SpriteSystem _sprite = default!;
+
         protected override void OnAppearanceChange(EntityUid uid, WiresVisualsComponent component, ref AppearanceChangeEvent args)
         {
             if (args.Sprite == null)
                 return;
 
-            var layer = args.Sprite.LayerMapReserveBlank(WiresVisualLayers.MaintenancePanel);
+            var layer = _sprite.LayerMapReserve((uid, args.Sprite), WiresVisualLayers.MaintenancePanel);
 
-            if(args.AppearanceData.TryGetValue(WiresVisuals.MaintenancePanelState, out var panelStateObject) &&
+            if (args.AppearanceData.TryGetValue(WiresVisuals.MaintenancePanelState, out var panelStateObject) &&
                 panelStateObject is bool panelState)
             {
-                args.Sprite.LayerSetVisible(layer, panelState);
+                _sprite.LayerSetVisible((uid, args.Sprite), layer, panelState);
             }
             else
             {
                 //Mainly for spawn window
-                args.Sprite.LayerSetVisible(layer, false);
+                _sprite.LayerSetVisible((uid, args.Sprite), layer, false);
             }
         }
     }
index be608c374b86cafacc805a8fac7c84db3b08c362..6d48a668a554cbfce25eee860c3e894186f63470 100644 (file)
@@ -1,9 +1,7 @@
 using System.Collections.Generic;
 using Content.Client.Weapons.Ranged.Components;
-using Content.Shared.Prototypes;
 using Robust.Client.GameObjects;
 using Robust.Shared.GameObjects;
-using Robust.Shared.Prototypes;
 
 namespace Content.IntegrationTests.Tests;
 
@@ -16,10 +14,11 @@ public sealed class MagazineVisualsSpriteTest
     [Test]
     public async Task MagazineVisualsSpritesExist()
     {
-        await using var pair = await PoolManager.GetServerClient();
+        await using var pair = await PoolManager.GetServerClient(new PoolSettings { Connected = true });
         var client = pair.Client;
         var toTest = new List<(int, string)>();
         var protos = pair.GetPrototypesWithComponent<MagazineVisualsComponent>();
+        var spriteSys = client.System<SpriteSystem>();
 
         await client.WaitAssertion(() =>
         {
@@ -36,9 +35,9 @@ public sealed class MagazineVisualsSpriteTest
                         @$"{proto.ID} has MagazineVisualsComponent but no AppearanceComponent.");
 
                     toTest.Clear();
-                    if (sprite.LayerMapTryGet(GunVisualLayers.Mag, out var magLayerId))
+                    if (spriteSys.LayerMapTryGet((uid, sprite), GunVisualLayers.Mag, out var magLayerId, false))
                         toTest.Add((magLayerId, ""));
-                    if (sprite.LayerMapTryGet(GunVisualLayers.MagUnshaded, out var magUnshadedLayerId))
+                    if (spriteSys.LayerMapTryGet((uid, sprite), GunVisualLayers.MagUnshaded, out var magUnshadedLayerId, false))
                         toTest.Add((magUnshadedLayerId, "-unshaded"));
 
                     Assert.That(
@@ -49,7 +48,7 @@ public sealed class MagazineVisualsSpriteTest
                     var start = visuals.ZeroVisible ? 0 : 1;
                     foreach (var (id, midfix) in toTest)
                     {
-                        Assert.That(sprite.TryGetLayer(id, out var layer));
+                        Assert.That(spriteSys.TryGetLayer((uid, sprite), id, out var layer, false));
                         var rsi = layer.ActualRsi;
                         for (var i = start; i < visuals.MagSteps; i++)
                         {