Allow solutions to store extra reagent data (#19323)
This commit is contained in:
@@ -113,6 +113,8 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
|
||||
private void SubtractContents(MicrowaveComponent component, FoodRecipePrototype recipe)
|
||||
{
|
||||
// TODO Turn recipe.IngredientsReagents into a ReagentQuantity[]
|
||||
|
||||
var totalReagentsToRemove = new Dictionary<string, FixedPoint2>(recipe.IngredientsReagents);
|
||||
|
||||
// this is spaghetti ngl
|
||||
@@ -130,10 +132,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
if (!totalReagentsToRemove.ContainsKey(reagent))
|
||||
continue;
|
||||
|
||||
if (!solution.ContainsReagent(reagent))
|
||||
continue;
|
||||
|
||||
var quant = solution.GetReagentQuantity(reagent);
|
||||
var quant = solution.GetTotalPrototypeQuantity(reagent);
|
||||
|
||||
if (quant >= totalReagentsToRemove[reagent])
|
||||
{
|
||||
@@ -145,7 +144,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
totalReagentsToRemove[reagent] -= quant;
|
||||
}
|
||||
|
||||
_solutionContainer.TryRemoveReagent(item, solution, reagent, quant);
|
||||
_solutionContainer.RemoveReagent(item, solution, reagent, quant);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -324,6 +323,8 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
|
||||
var solidsDict = new Dictionary<string, int>();
|
||||
var reagentDict = new Dictionary<string, FixedPoint2>();
|
||||
// TODO use lists of Reagent quantities instead of reagent prototype ids.
|
||||
|
||||
foreach (var item in component.Storage.ContainedEntities)
|
||||
{
|
||||
// special behavior when being microwaved ;)
|
||||
@@ -370,12 +371,12 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
|
||||
foreach (var (_, solution) in solMan.Solutions)
|
||||
{
|
||||
foreach (var reagent in solution.Contents)
|
||||
foreach (var (reagent, quantity) in solution.Contents)
|
||||
{
|
||||
if (reagentDict.ContainsKey(reagent.ReagentId))
|
||||
reagentDict[reagent.ReagentId] += reagent.Quantity;
|
||||
if (reagentDict.ContainsKey(reagent.Prototype))
|
||||
reagentDict[reagent.Prototype] += quantity;
|
||||
else
|
||||
reagentDict.Add(reagent.ReagentId, reagent.Quantity);
|
||||
reagentDict.Add(reagent.Prototype, quantity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -417,6 +418,7 @@ namespace Content.Server.Kitchen.EntitySystems
|
||||
|
||||
foreach (var reagent in recipe.IngredientsReagents)
|
||||
{
|
||||
// TODO Turn recipe.IngredientsReagents into a ReagentQuantity[]
|
||||
if (!reagents.ContainsKey(reagent.Key))
|
||||
return (recipe, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user