remove Injector SolutionName constant (#27493)

remove stupid constant
This commit is contained in:
Ed
2024-04-30 00:29:15 +03:00
committed by GitHub
parent 2cfc12c134
commit 91028a5149
4 changed files with 9 additions and 8 deletions

View File

@@ -32,7 +32,7 @@ public sealed class InjectorStatusControl : Control
{ {
base.FrameUpdate(args); 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; return;
// only updates the UI if any of the details are different than they previously were // only updates the UI if any of the details are different than they previously were

View File

@@ -124,7 +124,7 @@ public sealed class InjectorSystem : SharedInjectorSystem
Popup.PopupEntity(Loc.GetString("injector-component-injecting-user"), target, user); 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; return;
var actualDelay = MathHelper.Max(injector.Comp.Delay, TimeSpan.FromSeconds(1)); var actualDelay = MathHelper.Max(injector.Comp.Delay, TimeSpan.FromSeconds(1));
@@ -254,7 +254,7 @@ public sealed class InjectorSystem : SharedInjectorSystem
private void TryInject(Entity<InjectorComponent> injector, EntityUid targetEntity, private void TryInject(Entity<InjectorComponent> injector, EntityUid targetEntity,
Entity<SolutionComponent> targetSolution, EntityUid user, bool asRefill) Entity<SolutionComponent> 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) out var solution) || solution.Volume == 0)
return; return;
@@ -296,7 +296,7 @@ public sealed class InjectorSystem : SharedInjectorSystem
private void AfterInject(Entity<InjectorComponent> injector, EntityUid target) private void AfterInject(Entity<InjectorComponent> injector, EntityUid target)
{ {
// Automatically set syringe to draw after completely draining it. // 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) out var solution) && solution.Volume == 0)
{ {
SetMode(injector, InjectorToggleMode.Draw); SetMode(injector, InjectorToggleMode.Draw);
@@ -310,7 +310,7 @@ public sealed class InjectorSystem : SharedInjectorSystem
private void AfterDraw(Entity<InjectorComponent> injector, EntityUid target) private void AfterDraw(Entity<InjectorComponent> injector, EntityUid target)
{ {
// Automatically set syringe to inject after completely filling it. // 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) out var solution) && solution.AvailableVolume == 0)
{ {
SetMode(injector, InjectorToggleMode.Inject); SetMode(injector, InjectorToggleMode.Inject);
@@ -324,7 +324,7 @@ public sealed class InjectorSystem : SharedInjectorSystem
private void TryDraw(Entity<InjectorComponent> injector, Entity<BloodstreamComponent?> target, private void TryDraw(Entity<InjectorComponent> injector, Entity<BloodstreamComponent?> target,
Entity<SolutionComponent> targetSolution, EntityUid user) Entity<SolutionComponent> 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) out var solution) || solution.AvailableVolume == 0)
{ {
return; return;

View File

@@ -24,7 +24,8 @@ public sealed partial class InjectorDoAfterEvent : SimpleDoAfterEvent
[RegisterComponent, NetworkedComponent, AutoGenerateComponentState] [RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
public sealed partial class InjectorComponent : Component public sealed partial class InjectorComponent : Component
{ {
public const string SolutionName = "injector"; [DataField]
public string SolutionName = "injector";
/// <summary> /// <summary>
/// Whether or not the injector is able to draw from containers or if it's a single use /// Whether or not the injector is able to draw from containers or if it's a single use

View File

@@ -113,7 +113,7 @@ public abstract class SharedInjectorSystem : EntitySystem
if (injector.Comp.InjectOnly) if (injector.Comp.InjectOnly)
return; 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; return;
string msg; string msg;