using System.Linq;
+using Content.Client.Chemistry.Containers.EntitySystems;
using Content.Shared.Atmos.Prototypes;
using Content.Shared.Body.Part;
using Content.Shared.Chemistry;
/// <inheritdoc/>
public sealed class ChemistryGuideDataSystem : SharedChemistryGuideDataSystem
{
+ [Dependency] private readonly SolutionContainerSystem _solutionContainer = default!;
+
[ValidatePrototypeId<MixingCategoryPrototype>]
private const string DefaultMixingCategory = "DummyMix";
[ValidatePrototypeId<MixingCategoryPrototype>]
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 },
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))