]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup warnings in `AnomalySystem` (#37429)
authorTayrtahn <tayrtahn@gmail.com>
Tue, 13 May 2025 22:19:57 +0000 (18:19 -0400)
committerGitHub <noreply@github.com>
Tue, 13 May 2025 22:19:57 +0000 (00:19 +0200)
Cleanup warnings in AnomalySystem

Content.Client/Anomaly/AnomalySystem.cs

index 28c015f3021cdcfc50502a5dce58f69c6def4887..83f15a90867c787945eaf549e6f3c56695d944de 100644 (file)
@@ -11,6 +11,7 @@ public sealed class AnomalySystem : SharedAnomalySystem
 {
     [Dependency] private readonly IGameTiming _timing = default!;
     [Dependency] private readonly FloatingVisualizerSystem _floating = default!;
+    [Dependency] private readonly SpriteSystem _sprite = default!;
 
     /// <inheritdoc/>
     public override void Initialize()
@@ -49,12 +50,12 @@ public sealed class AnomalySystem : SharedAnomalySystem
         if (HasComp<AnomalySupercriticalComponent>(uid))
             pulsing = true;
 
-        if (!sprite.LayerMapTryGet(AnomalyVisualLayers.Base, out var layer) ||
-            !sprite.LayerMapTryGet(AnomalyVisualLayers.Animated, out var animatedLayer))
+        if (!_sprite.LayerMapTryGet((uid, sprite), AnomalyVisualLayers.Base, out var layer, false) ||
+            !_sprite.LayerMapTryGet((uid, sprite), AnomalyVisualLayers.Animated, out var animatedLayer, false))
             return;
 
-        sprite.LayerSetVisible(layer, !pulsing);
-        sprite.LayerSetVisible(animatedLayer, pulsing);
+        _sprite.LayerSetVisible((uid, sprite), layer, !pulsing);
+        _sprite.LayerSetVisible((uid, sprite), animatedLayer, pulsing);
     }
 
     public override void Update(float frameTime)
@@ -63,16 +64,16 @@ public sealed class AnomalySystem : SharedAnomalySystem
 
         var query = EntityQueryEnumerator<AnomalySupercriticalComponent, SpriteComponent>();
 
-        while (query.MoveNext(out var super, out var sprite))
+        while (query.MoveNext(out var uid, out var super, out var sprite))
         {
-            var completion = 1f - (float) ((super.EndTime - _timing.CurTime) / super.SupercriticalDuration);
+            var completion = 1f - (float)((super.EndTime - _timing.CurTime) / super.SupercriticalDuration);
             var scale = completion * (super.MaxScaleAmount - 1f) + 1f;
-            sprite.Scale = new Vector2(scale, scale);
+            _sprite.SetScale((uid, sprite), new Vector2(scale, scale));
 
-            var transparency = (byte) (65 * (1f - completion) + 190);
+            var transparency = (byte)(65 * (1f - completion) + 190);
             if (transparency < sprite.Color.AByte)
             {
-                sprite.Color = sprite.Color.WithAlpha(transparency);
+                _sprite.SetColor((uid, sprite), sprite.Color.WithAlpha(transparency));
             }
         }
     }
@@ -82,7 +83,7 @@ public sealed class AnomalySystem : SharedAnomalySystem
         if (!TryComp<SpriteComponent>(ent, out var sprite))
             return;
 
-        sprite.Scale = Vector2.One;
-        sprite.Color = sprite.Color.WithAlpha(1f);
+        _sprite.SetScale((ent.Owner, sprite), Vector2.One);
+        _sprite.SetColor((ent.Owner, sprite), sprite.Color.WithAlpha(1f));
     }
 }