Пример #1
0
 public static void Notify_CaravanMemberIngestedFood(Pawn p, float nutritionIngested)
 {
     if (!p.Dead && p.needs.joy != null)
     {
         if (nutritionIngested > 0f)
         {
             Pawn       pawn    = BestCaravanPawnUtility.FindBestEntertainingPawnFor(p.GetCaravan(), p);
             JoyKindDef joyKind = (pawn == null) ? JoyKindDefOf.Meditative : Rand.Element <JoyKindDef>(JoyKindDefOf.Meditative, JoyKindDefOf.Social);
             float      amount  = 0.2f * Mathf.Min(nutritionIngested / p.needs.food.MaxLevel, 1f);
             p.needs.joy.GainJoy(amount, joyKind);
         }
     }
 }
Пример #2
0
        public static float GetCurrentJoyGainPerTick(Pawn pawn, Caravan caravan)
        {
            float result;

            if (caravan.pather.MovingNow)
            {
                result = 0f;
            }
            else
            {
                Pawn pawn2 = BestCaravanPawnUtility.FindBestEntertainingPawnFor(caravan, pawn);
                if (pawn2 == null)
                {
                    result = 0f;
                }
                else
                {
                    float statValue = pawn2.GetStatValue(StatDefOf.SocialImpact, true);
                    result = statValue * 0.035f / 2500f;
                }
            }
            return(result);
        }