]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup warnings in `ThrusterSystem` (#37489)
authorTayrtahn <tayrtahn@gmail.com>
Thu, 15 May 2025 20:06:30 +0000 (16:06 -0400)
committerGitHub <noreply@github.com>
Thu, 15 May 2025 20:06:30 +0000 (22:06 +0200)
Cleanup warnings in ThrusterSystem

Content.Client/Shuttles/ThrusterSystem.cs

index afa5b773db95a4074b4a3e4f16051732f86aa6c1..4205879b164b61e17d69a3029275b2876d7cc68e 100644 (file)
@@ -4,10 +4,12 @@ using Robust.Client.GameObjects;
 namespace Content.Client.Shuttles;
 
 /// <summary>
-/// Handles making a thruster visibly turn on/emit an exhaust plume according to its state. 
+/// Handles making a thruster visibly turn on/emit an exhaust plume according to its state.
 /// </summary>
 public sealed class ThrusterSystem : VisualizerSystem<ThrusterComponent>
 {
+    [Dependency] private readonly SpriteSystem _sprite = default!;
+
     /// <summary>
     /// Updates whether or not the thruster is visibly active/thrusting.
     /// </summary>
@@ -17,7 +19,7 @@ public sealed class ThrusterSystem : VisualizerSystem<ThrusterComponent>
         || !AppearanceSystem.TryGetData<bool>(uid, ThrusterVisualState.State, out var state, args.Component))
             return;
 
-        args.Sprite.LayerSetVisible(ThrusterVisualLayers.ThrustOn, state);
+        _sprite.LayerSetVisible((uid, args.Sprite), ThrusterVisualLayers.ThrustOn, state);
         SetThrusting(
             uid,
             state && AppearanceSystem.TryGetData<bool>(uid, ThrusterVisualState.Thrusting, out var thrusting, args.Component) && thrusting,
@@ -28,16 +30,16 @@ public sealed class ThrusterSystem : VisualizerSystem<ThrusterComponent>
     /// <summary>
     /// Sets whether or not the exhaust plume of the thruster is visible or not.
     /// </summary>
-    private static void SetThrusting(EntityUid _, bool value, SpriteComponent sprite)
+    private void SetThrusting(EntityUid uid, bool value, SpriteComponent sprite)
     {
-        if (sprite.LayerMapTryGet(ThrusterVisualLayers.Thrusting, out var thrustingLayer))
+        if (_sprite.LayerMapTryGet((uid, sprite), ThrusterVisualLayers.Thrusting, out var thrustingLayer, false))
         {
-            sprite.LayerSetVisible(thrustingLayer, value);
+            _sprite.LayerSetVisible((uid, sprite), thrustingLayer, value);
         }
 
-        if (sprite.LayerMapTryGet(ThrusterVisualLayers.ThrustingUnshaded, out var unshadedLayer))
+        if (_sprite.LayerMapTryGet((uid, sprite), ThrusterVisualLayers.ThrustingUnshaded, out var unshadedLayer, false))
         {
-            sprite.LayerSetVisible(unshadedLayer, value);
+            _sprite.LayerSetVisible((uid, sprite), unshadedLayer, value);
         }
     }
 }