From: Ed <96445749+TheShuEd@users.noreply.github.com> Date: Mon, 29 Apr 2024 21:29:15 +0000 (+0300) Subject: remove Injector SolutionName constant (#27493) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=91028a514907b57affda1a03efa4684d5b7e8196;p=space-station-14.git remove Injector SolutionName constant (#27493) remove stupid constant --- diff --git a/Content.Client/Chemistry/UI/InjectorStatusControl.cs b/Content.Client/Chemistry/UI/InjectorStatusControl.cs index ba1f97cd1e..f9b0d90e20 100644 --- a/Content.Client/Chemistry/UI/InjectorStatusControl.cs +++ b/Content.Client/Chemistry/UI/InjectorStatusControl.cs @@ -32,7 +32,7 @@ public sealed class InjectorStatusControl : Control { base.FrameUpdate(args); - if (!_solutionContainers.TryGetSolution(_parent.Owner, InjectorComponent.SolutionName, out _, out var solution)) + if (!_solutionContainers.TryGetSolution(_parent.Owner, _parent.Comp.SolutionName, out _, out var solution)) return; // only updates the UI if any of the details are different than they previously were diff --git a/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs b/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs index 85d4ade3a4..77c8620ea4 100644 --- a/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs +++ b/Content.Server/Chemistry/EntitySystems/InjectorSystem.cs @@ -124,7 +124,7 @@ public sealed class InjectorSystem : SharedInjectorSystem Popup.PopupEntity(Loc.GetString("injector-component-injecting-user"), target, user); } - if (!SolutionContainers.TryGetSolution(injector.Owner, InjectorComponent.SolutionName, out _, out var solution)) + if (!SolutionContainers.TryGetSolution(injector.Owner, injector.Comp.SolutionName, out _, out var solution)) return; var actualDelay = MathHelper.Max(injector.Comp.Delay, TimeSpan.FromSeconds(1)); @@ -254,7 +254,7 @@ public sealed class InjectorSystem : SharedInjectorSystem private void TryInject(Entity injector, EntityUid targetEntity, Entity targetSolution, EntityUid user, bool asRefill) { - if (!SolutionContainers.TryGetSolution(injector.Owner, InjectorComponent.SolutionName, out var soln, + if (!SolutionContainers.TryGetSolution(injector.Owner, injector.Comp.SolutionName, out var soln, out var solution) || solution.Volume == 0) return; @@ -296,7 +296,7 @@ public sealed class InjectorSystem : SharedInjectorSystem private void AfterInject(Entity injector, EntityUid target) { // Automatically set syringe to draw after completely draining it. - if (SolutionContainers.TryGetSolution(injector.Owner, InjectorComponent.SolutionName, out _, + if (SolutionContainers.TryGetSolution(injector.Owner, injector.Comp.SolutionName, out _, out var solution) && solution.Volume == 0) { SetMode(injector, InjectorToggleMode.Draw); @@ -310,7 +310,7 @@ public sealed class InjectorSystem : SharedInjectorSystem private void AfterDraw(Entity injector, EntityUid target) { // Automatically set syringe to inject after completely filling it. - if (SolutionContainers.TryGetSolution(injector.Owner, InjectorComponent.SolutionName, out _, + if (SolutionContainers.TryGetSolution(injector.Owner, injector.Comp.SolutionName, out _, out var solution) && solution.AvailableVolume == 0) { SetMode(injector, InjectorToggleMode.Inject); @@ -324,7 +324,7 @@ public sealed class InjectorSystem : SharedInjectorSystem private void TryDraw(Entity injector, Entity target, Entity targetSolution, EntityUid user) { - if (!SolutionContainers.TryGetSolution(injector.Owner, InjectorComponent.SolutionName, out var soln, + if (!SolutionContainers.TryGetSolution(injector.Owner, injector.Comp.SolutionName, out var soln, out var solution) || solution.AvailableVolume == 0) { return; diff --git a/Content.Shared/Chemistry/Components/InjectorComponent.cs b/Content.Shared/Chemistry/Components/InjectorComponent.cs index 605a15d73a..ee7f9bd579 100644 --- a/Content.Shared/Chemistry/Components/InjectorComponent.cs +++ b/Content.Shared/Chemistry/Components/InjectorComponent.cs @@ -24,7 +24,8 @@ public sealed partial class InjectorDoAfterEvent : SimpleDoAfterEvent [RegisterComponent, NetworkedComponent, AutoGenerateComponentState] public sealed partial class InjectorComponent : Component { - public const string SolutionName = "injector"; + [DataField] + public string SolutionName = "injector"; /// /// Whether or not the injector is able to draw from containers or if it's a single use diff --git a/Content.Shared/Chemistry/EntitySystems/SharedInjectorSystem.cs b/Content.Shared/Chemistry/EntitySystems/SharedInjectorSystem.cs index 6c43c1d5f0..1620344652 100644 --- a/Content.Shared/Chemistry/EntitySystems/SharedInjectorSystem.cs +++ b/Content.Shared/Chemistry/EntitySystems/SharedInjectorSystem.cs @@ -113,7 +113,7 @@ public abstract class SharedInjectorSystem : EntitySystem if (injector.Comp.InjectOnly) return; - if (!SolutionContainers.TryGetSolution(injector.Owner, InjectorComponent.SolutionName, out var solEnt, out var solution)) + if (!SolutionContainers.TryGetSolution(injector.Owner, injector.Comp.SolutionName, out var solEnt, out var solution)) return; string msg;