private static void AddIngestThoughtsFromIngredient(ThingDef ingredient, Pawn ingester, List <ThoughtDef> ingestThoughts) { if (ingredient.ingestible != null) { if (ingester.RaceProps.Humanlike && FoodUtility.IsHumanlikeMeat(ingredient)) { ingestThoughts.Add((!ingester.story.traits.HasTrait(TraitDefOf.Cannibal)) ? ThoughtDefOf.AteHumanlikeMeatAsIngredient : ThoughtDefOf.AteHumanlikeMeatAsIngredientCannibal); } else if (ingredient.ingestible.specialThoughtAsIngredient != null) { ingestThoughts.Add(ingredient.ingestible.specialThoughtAsIngredient); } } }
public static bool IsHumanlikeMeatOrHumanlikeCorpse(Thing thing) { if (FoodUtility.IsHumanlikeMeat(thing.def)) { return(true); } Corpse corpse = thing as Corpse; if (corpse != null && corpse.InnerPawn.RaceProps.Humanlike) { return(true); } return(false); }
public static List <ThoughtDef> ThoughtsFromIngesting(Pawn ingester, Thing foodSource, ThingDef foodDef) { FoodUtility.ingestThoughts.Clear(); if (ingester.needs != null && ingester.needs.mood != null) { if (!ingester.story.traits.HasTrait(TraitDefOf.Ascetic) && foodDef.ingestible.tasteThought != null) { FoodUtility.ingestThoughts.Add(foodDef.ingestible.tasteThought); } CompIngredients compIngredients = foodSource.TryGetComp <CompIngredients>(); Building_NutrientPasteDispenser building_NutrientPasteDispenser = foodSource as Building_NutrientPasteDispenser; if (FoodUtility.IsHumanlikeMeat(foodDef) && ingester.RaceProps.Humanlike) { FoodUtility.ingestThoughts.Add((!ingester.story.traits.HasTrait(TraitDefOf.Cannibal)) ? ThoughtDefOf.AteHumanlikeMeatDirect : ThoughtDefOf.AteHumanlikeMeatDirectCannibal); } else if (compIngredients != null) { for (int i = 0; i < compIngredients.ingredients.Count; i++) { FoodUtility.AddIngestThoughtsFromIngredient(compIngredients.ingredients[i], ingester, FoodUtility.ingestThoughts); } } else if (building_NutrientPasteDispenser != null) { Thing thing = building_NutrientPasteDispenser.FindFeedInAnyHopper(); if (thing != null) { FoodUtility.AddIngestThoughtsFromIngredient(thing.def, ingester, FoodUtility.ingestThoughts); } } if (foodDef.ingestible.specialThoughtDirect != null) { FoodUtility.ingestThoughts.Add(foodDef.ingestible.specialThoughtDirect); } if (foodSource.IsNotFresh()) { FoodUtility.ingestThoughts.Add(ThoughtDefOf.AteRottenFood); } return(FoodUtility.ingestThoughts); } return(FoodUtility.ingestThoughts); }