public static bool TotalOpinionOffset(ThoughtHandler __instance, ref int __result, Pawn otherPawn) { List <ISocialThought> tmpTotalOpinionOffsetThoughts = new List <ISocialThought>(); __instance.GetDistinctSocialThoughtGroups(otherPawn, tmpTotalOpinionOffsetThoughts); int num = 0; int opinionOffset = 0; for (int index = 0; index < tmpTotalOpinionOffsetThoughts.Count; ++index) { OpinionOffsetOfGroup(__instance, ref opinionOffset, tmpTotalOpinionOffsetThoughts[index], otherPawn); num += opinionOffset; } tmpTotalOpinionOffsetThoughts.Clear(); __result = num; return(false); }
internal static void CreateThoughtList(List <Pawn> pawns) { // for each pawn... ThoughtsAbout = new Dictionary <Pawn, List <string> >(); foreach (Pawn pawn in pawns) { // add list for this pawn ThoughtsAbout.Add(pawn, new List <string>()); // get thoughts targeted at the pawn by all other pawns... foreach (Pawn other in pawns.Where(p => p != pawn)) { ThoughtHandler thoughts = other.needs?.mood?.thoughts; if (thoughts == null) { continue; } // get distinct social thoughts var DistinctSocialThoughtGroups = new List <ISocialThought>(); thoughts.GetDistinctSocialThoughtGroups(pawn, DistinctSocialThoughtGroups); foreach (ISocialThought t in DistinctSocialThoughtGroups) { var thought = (Thought)t; if (t.OpinionOffset() != 0) { ThoughtsAbout[pawn].Add(thought.LabelCapSocial); } } } // remove duplicates if (!ThoughtsAbout[pawn].NullOrEmpty()) { ThoughtsAbout[pawn] = ThoughtsAbout[pawn].Distinct().ToList(); } } }