From a425bc78c56dd42eff1cab2938d92caf4e1b5962 Mon Sep 17 00:00:00 2001 From: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Date: Sun, 31 Dec 2023 12:11:29 -0500 Subject: [PATCH] Fix chem guide data build fail (#23289) --- .../EntitySystems/ChemistryGuideDataSystem.cs | 6 +++++- .../EntitySystems/SharedSolutionContainerSystem.cs | 12 ++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Content.Client/Chemistry/EntitySystems/ChemistryGuideDataSystem.cs b/Content.Client/Chemistry/EntitySystems/ChemistryGuideDataSystem.cs index 4a9bd60dcb..a3cedb5f2f 100644 --- a/Content.Client/Chemistry/EntitySystems/ChemistryGuideDataSystem.cs +++ b/Content.Client/Chemistry/EntitySystems/ChemistryGuideDataSystem.cs @@ -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; /// public sealed class ChemistryGuideDataSystem : SharedChemistryGuideDataSystem { + [Dependency] private readonly SolutionContainerSystem _solutionContainer = default!; + [ValidatePrototypeId] private const string DefaultMixingCategory = "DummyMix"; [ValidatePrototypeId] @@ -116,9 +119,10 @@ public sealed class ChemistryGuideDataSystem : SharedChemistryGuideDataSystem usedNames.Add(entProto.Name); } + if (extractableComponent.GrindableSolution is { } grindableSolutionId && entProto.TryGetComponent(out var manager) && - manager.Solutions.TryGetValue(grindableSolutionId, out var grindableSolution)) + _solutionContainer.TryGetSolution(manager, grindableSolutionId, out var grindableSolution)) { var data = new ReagentEntitySourceData( new() { DefaultGrindCategory }, diff --git a/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs b/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs index 392b83fe97..fc83d46f4b 100644 --- a/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs +++ b/Content.Shared/Chemistry/EntitySystems/SharedSolutionContainerSystem.cs @@ -158,6 +158,18 @@ public abstract partial class SharedSolutionContainerSystem : EntitySystem return true; } + /// + /// 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 Solution)> EnumerateSolutions(Entity container, bool includeSelf = true) { if (includeSelf && TryComp(container, out SolutionComponent? solutionComp))