Allow solutions to store extra reagent data (#19323)

This commit is contained in:
Leon Friedrich
2023-09-05 09:55:10 +12:00
committed by GitHub
parent a6b81058d0
commit e4ca6f4fb9
52 changed files with 932 additions and 538 deletions

View File

@@ -136,7 +136,9 @@ namespace Content.Shared.Chemistry.Reaction
var reactantName = reactantData.Key;
var reactantCoefficient = reactantData.Value.Amount;
if (!solution.TryGetReagent(reactantName, out var reactantQuantity))
var reactantQuantity = solution.GetTotalPrototypeQuantity(reactantName);
if (reactantQuantity <= FixedPoint2.Zero)
return false;
if (reactantData.Value.Catalyst)
@@ -292,7 +294,7 @@ namespace Content.Shared.Chemistry.Reaction
SortedSet<ReactionPrototype> reactions = new();
foreach (var reactant in solution.Contents)
{
if (_reactions.TryGetValue(reactant.ReagentId, out var reactantReactions))
if (_reactions.TryGetValue(reactant.Reagent.Prototype, out var reactantReactions))
reactions.UnionWith(reactantReactions);
}