]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix chem guide data build fail (#23289)
authorNemanja <98561806+EmoGarbage404@users.noreply.github.com>
Sun, 31 Dec 2023 17:11:29 +0000 (12:11 -0500)
committerGitHub <noreply@github.com>
Sun, 31 Dec 2023 17:11:29 +0000 (12:11 -0500)
Content.Client/Chemistry/EntitySystems/ChemistryGuideDataSystem.cs
Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs

index 4a9bd60dcbfe699806063a1f1f0530f72e2a93b7..a3cedb5f2f382483db663736aa2c2756cedd0773 100644 (file)
@@ -1,4 +1,5 @@
 using System.Linq;
+using Content.Client.Chemistry.Containers.EntitySystems;
 using Content.Shared.Atmos.Prototypes;
 using Content.Shared.Body.Part;
 using Content.Shared.Chemistry;
@@ -15,6 +16,8 @@ namespace Content.Client.Chemistry.EntitySystems;
 /// <inheritdoc/>
 public sealed class ChemistryGuideDataSystem : SharedChemistryGuideDataSystem
 {
+    [Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
+
     [ValidatePrototypeId<MixingCategoryPrototype>]
     private const string DefaultMixingCategory = "DummyMix";
     [ValidatePrototypeId<MixingCategoryPrototype>]
@@ -116,9 +119,10 @@ public sealed class ChemistryGuideDataSystem : SharedChemistryGuideDataSystem
                 usedNames.Add(entProto.Name);
             }
 
+
             if (extractableComponent.GrindableSolution is { } grindableSolutionId &&
                 entProto.TryGetComponent<SolutionContainerManagerComponent>(out var manager) &&
-                manager.Solutions.TryGetValue(grindableSolutionId, out var grindableSolution))
+                _solutionContainer.TryGetSolution(manager, grindableSolutionId, out var grindableSolution))
             {
                 var data = new ReagentEntitySourceData(
                     new() { DefaultGrindCategory },
index 392b83fe976ccc4c0ce70c23c5cb76eede0742b8..fc83d46f4b954deac60bb5a92ca528e970d6dda8 100644 (file)
@@ -158,6 +158,18 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem
         return true;
     }
 
+    /// <summary>
+    /// Version of TryGetSolution that doesn't take or return an entity.
+    /// Used for prototypes and with old code parity.
+    public bool TryGetSolution(SolutionContainerManagerComponent container, string name, [NotNullWhen(true)] out Solution? solution)
+    {
+        solution = null;
+        if (container.Solutions == null)
+            return false;
+
+        return container.Solutions.TryGetValue(name, out solution);
+    }
+
     public IEnumerable<(string? Name, Entity<SolutionComponent> Solution)> EnumerateSolutions(Entity<SolutionContainerManagerComponent?> container, bool includeSelf = true)
     {
         if (includeSelf && TryComp(container, out SolutionComponent? solutionComp))