diff --git a/Source/ProcessorFramework/CompProcessor.cs b/Source/ProcessorFramework/CompProcessor.cs index 65790b5..46621d7 100644 --- a/Source/ProcessorFramework/CompProcessor.cs +++ b/Source/ProcessorFramework/CompProcessor.cs @@ -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 = thing.TryGetComp(); List ingredientList = new List(); foreach (Thing ingredientThing in activeProcess.ingredientThings) { @@ -501,6 +501,27 @@ public Thing TakeOutProduct(ActiveProcess activeProcess) if (compIngredients != null && !ingredientList.NullOrEmpty()) { compIngredients.ingredients.AddRange(ingredientList); + } */ + + if (thing.TryGetComp() is CompIngredients compIngredients) + { + List ingredientList = new List(); + foreach (Thing ingredientThing in activeProcess.ingredientThings) + { + List innerIngredients = ingredientThing.TryGetComp()?.ingredients; + if (!innerIngredients.NullOrEmpty()) + { + ingredientList.AddRange(innerIngredients); + } + else + { + compIngredients.RegisterIngredient(ingredientThing.def); + } + } + if (compIngredients != null && !ingredientList.NullOrEmpty()) + { + compIngredients.ingredients.AddRange(ingredientList); + } } //Quality