]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Chemistry warnings cleanup (#36160)
authorJ <billsmith116@gmail.com>
Sun, 30 Mar 2025 12:07:34 +0000 (12:07 +0000)
committerGitHub <noreply@github.com>
Sun, 30 Mar 2025 12:07:34 +0000 (14:07 +0200)
* Chemistry warnings cleanup

* Fixing failed ITest

* Better entity instantiation

* Caching spritesystem and entity instantiation improvement

* Correcting naming conventions

* Rearranging dependency caching

Content.Client/Chemistry/UI/ChemMasterWindow.xaml.cs
Content.Client/Chemistry/Visualizers/FoamVisualizerSystem.cs
Content.Client/Chemistry/Visualizers/VaporVisualizerSystem.cs

index 807ec4c1e7c4979760b3a8a3d8312cdb07390a84..e264b859a017a8bee21807079c733ee4102e92f3 100644 (file)
@@ -6,7 +6,6 @@ using Robust.Client.AutoGenerated;
 using Robust.Client.UserInterface;
 using Robust.Client.UserInterface.Controls;
 using Robust.Client.UserInterface.XAML;
-using Robust.Client.Utility;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Utility;
 using System.Linq;
@@ -14,6 +13,7 @@ using System.Numerics;
 using Content.Shared.FixedPoint;
 using Robust.Client.Graphics;
 using static Robust.Client.UserInterface.Controls.BoxContainer;
+using Robust.Client.GameObjects;
 
 namespace Content.Client.Chemistry.UI
 {
@@ -24,6 +24,10 @@ namespace Content.Client.Chemistry.UI
     public sealed partial class ChemMasterWindow : FancyWindow
     {
         [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
+        [Dependency] private readonly IEntityManager _entityManager = default!;
+
+        private readonly SpriteSystem _sprite;
+
         public event Action<BaseButton.ButtonEventArgs, ReagentButton>? OnReagentButtonPressed;
         public readonly Button[] PillTypeButtons;
 
@@ -38,6 +42,8 @@ namespace Content.Client.Chemistry.UI
             RobustXamlLoader.Load(this);
             IoCManager.InjectDependencies(this);
 
+            _sprite = _entityManager.System<SpriteSystem>();
+
             // Pill type selection buttons, in total there are 20 pills.
             // Pill rsi file should have states named as pill1, pill2, and so on.
             var resourcePath = new ResPath(PillsRsiPath);
@@ -69,7 +75,7 @@ namespace Content.Client.Chemistry.UI
                 var specifier = new SpriteSpecifier.Rsi(resourcePath, "pill" + (i + 1));
                 TextureRect pillTypeTexture = new TextureRect
                 {
-                    Texture = specifier.Frame0(),
+                    Texture = _sprite.Frame0(specifier),
                     TextureScale = new Vector2(1.75f, 1.75f),
                     Stretch = TextureRect.StretchMode.KeepCentered,
                 };
index 2ee88956ff60f01053616f5010984e37e42018d0..2f895718c71b4927b0ba21a75cf0e5af8d2804aa 100644 (file)
@@ -1,4 +1,4 @@
-using Content.Shared.Chemistry.Components;
+using Content.Shared.Chemistry.Components;
 using Robust.Client.Animations;
 using Robust.Client.GameObjects;
 using Robust.Shared.Timing;
@@ -37,7 +37,7 @@ public sealed class FoamVisualizerSystem : VisualizerSystem<FoamVisualsComponent
             if (TryComp(uid, out AnimationPlayerComponent? animPlayer)
                 && !AnimationSystem.HasRunningAnimation(uid, animPlayer, FoamVisualsComponent.AnimationKey))
             {
-                AnimationSystem.Play(uid, animPlayer, comp.Animation, FoamVisualsComponent.AnimationKey);
+                AnimationSystem.Play((uid, animPlayer), comp.Animation, FoamVisualsComponent.AnimationKey);
             }
         }
     }
index 6c086198dbc9da6f0b75a984af298ec81140b2d4..95373077f9b38c91886732291d0855863f04c81c 100644 (file)
@@ -1,4 +1,4 @@
-using Content.Shared.Vapor;
+using Content.Shared.Vapor;
 using Robust.Client.Animations;
 using Robust.Client.GameObjects;
 
@@ -41,7 +41,7 @@ public sealed class VaporVisualizerSystem : VisualizerSystem<VaporVisualsCompone
             TryComp<AnimationPlayerComponent>(uid, out var animPlayer) &&
             !AnimationSystem.HasRunningAnimation(uid, animPlayer, VaporVisualsComponent.AnimationKey))
         {
-            AnimationSystem.Play(uid, animPlayer, comp.VaporFlick, VaporVisualsComponent.AnimationKey);
+            AnimationSystem.Play((uid, animPlayer), comp.VaporFlick, VaporVisualsComponent.AnimationKey);
         }
     }