From 98c393474a7a799d1cad80597b14a5b5a6197d9b Mon Sep 17 00:00:00 2001 From: Tayrtahn Date: Thu, 15 May 2025 16:06:30 -0400 Subject: [PATCH] Cleanup warnings in `ThrusterSystem` (#37489) Cleanup warnings in ThrusterSystem --- Content.Client/Shuttles/ThrusterSystem.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Content.Client/Shuttles/ThrusterSystem.cs b/Content.Client/Shuttles/ThrusterSystem.cs index afa5b773db..4205879b16 100644 --- a/Content.Client/Shuttles/ThrusterSystem.cs +++ b/Content.Client/Shuttles/ThrusterSystem.cs @@ -4,10 +4,12 @@ using Robust.Client.GameObjects; namespace Content.Client.Shuttles; /// -/// 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. /// public sealed class ThrusterSystem : VisualizerSystem { + [Dependency] private readonly SpriteSystem _sprite = default!; + /// /// Updates whether or not the thruster is visibly active/thrusting. /// @@ -17,7 +19,7 @@ public sealed class ThrusterSystem : VisualizerSystem || !AppearanceSystem.TryGetData(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(uid, ThrusterVisualState.Thrusting, out var thrusting, args.Component) && thrusting, @@ -28,16 +30,16 @@ public sealed class ThrusterSystem : VisualizerSystem /// /// Sets whether or not the exhaust plume of the thruster is visible or not. /// - 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); } } } -- 2.51.2