public int MaxAgeForPawn(Pawn pawn) { if (!maxAgeLookup.TryGetValue(pawn.def, out int age)) { SimpleCurve simpleCurve = pawn.def.race.ageGenerationCurve; if (simpleCurve == null) { Logger.Warning("No age generation curve defined for " + pawn.def.defName + ". Using default age generation curve to determine maximum age."); simpleCurve = DefaultAgeGenerationCurve; if (simpleCurve == null) { Logger.Warning("Failed to get default age generation curve. Using default maximum age of " + DEFAULT_MAX_AGE); age = DEFAULT_MAX_AGE; } else { age = Mathf.CeilToInt(pawn.def.race.lifeExpectancy * simpleCurve.Last().x); } } else { CurvePoint point = simpleCurve.Last(); age = (int)(point.x * 1.2f); } maxAgeLookup.Add(pawn.def, age); } return(age); }