Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion Source/ProcessorFramework/CompProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ public Thing TakeOutProduct(ActiveProcess activeProcess)
thing.stackCount = GenMath.RoundRandom(activeProcess.ingredientCount * activeProcess.processDef.efficiency);

//Ingredient transfer
CompIngredients compIngredients = thing.TryGetComp<CompIngredients>();
/* CompIngredients compIngredients = thing.TryGetComp<CompIngredients>();
List<ThingDef> ingredientList = new List<ThingDef>();
foreach (Thing ingredientThing in activeProcess.ingredientThings)
{
Expand All @@ -501,6 +501,27 @@ public Thing TakeOutProduct(ActiveProcess activeProcess)
if (compIngredients != null && !ingredientList.NullOrEmpty())
{
compIngredients.ingredients.AddRange(ingredientList);
} */

if (thing.TryGetComp<CompIngredients>() is CompIngredients compIngredients)
{
List<ThingDef> ingredientList = new List<ThingDef>();
foreach (Thing ingredientThing in activeProcess.ingredientThings)
{
List<ThingDef> innerIngredients = ingredientThing.TryGetComp<CompIngredients>()?.ingredients;
if (!innerIngredients.NullOrEmpty())
{
ingredientList.AddRange(innerIngredients);
}
else
{
compIngredients.RegisterIngredient(ingredientThing.def);
}
}
if (compIngredients != null && !ingredientList.NullOrEmpty())
{
compIngredients.ingredients.AddRange(ingredientList);
}
}

//Quality
Expand Down