Fix chem guide data build fail (#23289)
This commit is contained in:
@@ -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 },
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user