Chemistry warnings cleanup (#36160)

* Chemistry warnings cleanup

* Fixing failed ITest

* Better entity instantiation

* Caching spritesystem and entity instantiation improvement

* Correcting naming conventions

* Rearranging dependency caching
This commit is contained in:
J
2025-03-30 12:07:34 +00:00
committed by GitHub
parent 0180a9db50
commit 504e70be2b
3 changed files with 12 additions and 6 deletions

View File

@@ -6,7 +6,6 @@ using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML; using Robust.Client.UserInterface.XAML;
using Robust.Client.Utility;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Utility; using Robust.Shared.Utility;
using System.Linq; using System.Linq;
@@ -14,6 +13,7 @@ using System.Numerics;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Robust.Client.Graphics; using Robust.Client.Graphics;
using static Robust.Client.UserInterface.Controls.BoxContainer; using static Robust.Client.UserInterface.Controls.BoxContainer;
using Robust.Client.GameObjects;
namespace Content.Client.Chemistry.UI namespace Content.Client.Chemistry.UI
{ {
@@ -24,6 +24,10 @@ namespace Content.Client.Chemistry.UI
public sealed partial class ChemMasterWindow : FancyWindow public sealed partial class ChemMasterWindow : FancyWindow
{ {
[Dependency] private readonly IPrototypeManager _prototypeManager = default!; [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
private readonly SpriteSystem _sprite;
public event Action<BaseButton.ButtonEventArgs, ReagentButton>? OnReagentButtonPressed; public event Action<BaseButton.ButtonEventArgs, ReagentButton>? OnReagentButtonPressed;
public readonly Button[] PillTypeButtons; public readonly Button[] PillTypeButtons;
@@ -38,6 +42,8 @@ namespace Content.Client.Chemistry.UI
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
_sprite = _entityManager.System<SpriteSystem>();
// Pill type selection buttons, in total there are 20 pills. // Pill type selection buttons, in total there are 20 pills.
// Pill rsi file should have states named as pill1, pill2, and so on. // Pill rsi file should have states named as pill1, pill2, and so on.
var resourcePath = new ResPath(PillsRsiPath); var resourcePath = new ResPath(PillsRsiPath);
@@ -69,7 +75,7 @@ namespace Content.Client.Chemistry.UI
var specifier = new SpriteSpecifier.Rsi(resourcePath, "pill" + (i + 1)); var specifier = new SpriteSpecifier.Rsi(resourcePath, "pill" + (i + 1));
TextureRect pillTypeTexture = new TextureRect TextureRect pillTypeTexture = new TextureRect
{ {
Texture = specifier.Frame0(), Texture = _sprite.Frame0(specifier),
TextureScale = new Vector2(1.75f, 1.75f), TextureScale = new Vector2(1.75f, 1.75f),
Stretch = TextureRect.StretchMode.KeepCentered, Stretch = TextureRect.StretchMode.KeepCentered,
}; };

View File

@@ -1,4 +1,4 @@
using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Components;
using Robust.Client.Animations; using Robust.Client.Animations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Shared.Timing; using Robust.Shared.Timing;
@@ -37,7 +37,7 @@ public sealed class FoamVisualizerSystem : VisualizerSystem<FoamVisualsComponent
if (TryComp(uid, out AnimationPlayerComponent? animPlayer) if (TryComp(uid, out AnimationPlayerComponent? animPlayer)
&& !AnimationSystem.HasRunningAnimation(uid, animPlayer, FoamVisualsComponent.AnimationKey)) && !AnimationSystem.HasRunningAnimation(uid, animPlayer, FoamVisualsComponent.AnimationKey))
{ {
AnimationSystem.Play(uid, animPlayer, comp.Animation, FoamVisualsComponent.AnimationKey); AnimationSystem.Play((uid, animPlayer), comp.Animation, FoamVisualsComponent.AnimationKey);
} }
} }
} }

View File

@@ -1,4 +1,4 @@
using Content.Shared.Vapor; using Content.Shared.Vapor;
using Robust.Client.Animations; using Robust.Client.Animations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
@@ -41,7 +41,7 @@ public sealed class VaporVisualizerSystem : VisualizerSystem<VaporVisualsCompone
TryComp<AnimationPlayerComponent>(uid, out var animPlayer) && TryComp<AnimationPlayerComponent>(uid, out var animPlayer) &&
!AnimationSystem.HasRunningAnimation(uid, animPlayer, VaporVisualsComponent.AnimationKey)) !AnimationSystem.HasRunningAnimation(uid, animPlayer, VaporVisualsComponent.AnimationKey))
{ {
AnimationSystem.Play(uid, animPlayer, comp.VaporFlick, VaporVisualsComponent.AnimationKey); AnimationSystem.Play((uid, animPlayer), comp.VaporFlick, VaporVisualsComponent.AnimationKey);
} }
} }