/// <summary> /// Thread-safe version for vanilla. /// </summary> /// <returns></returns> private float TotalMoodOffsetThreadSafe() { List <Thought> curThoughts = _moodOffsetThoughts.Value; ThoughtHandler handler = _backingField.Pawn.needs?.mood?.thoughts; if (handler is null) { return(0f); } handler.GetDistinctMoodThoughtGroups(curThoughts); return(curThoughts.Sum(t => MoodOffsetOfGroup(t, handler))); }
public static bool TotalMoodOffset(ThoughtHandler __instance, ref float __result) { List <Thought> tmpThoughts = new List <Thought>(); __instance.GetDistinctMoodThoughtGroups(tmpThoughts); float num = 0.0f; float moodOffset = 0f; for (int index = 0; index < tmpThoughts.Count; ++index) { MoodOffsetOfGroup(__instance, ref moodOffset, tmpThoughts[index]); num += moodOffset; } tmpThoughts.Clear(); __result = num; return(false); }