public static void Postfix(Pawn pawn)
        {
            if (!PawnHelper.is_human(pawn))
            {
                return;
            }

            if (BodyPartDefOf.Maturity == null)
            {
                throw new Exception("BodyPartDefOf.Maturity missing!");
            }

            var maturityPart = PawnHelper.MaturityPart(pawn);

            if (maturityPart == null)
            {
                return;
            }

            if (pawn.health.hediffSet.HasHediff(HediffDefOf.LifeStages_Adult))
            {
                return;
            }

            var pubertySettings = pawn.RacePubertySetting();

            ChestManager.intialChest(pawn);

            if (pubertySettings.instantPubertySetting)
            {
                DoPuberty(pawn, maturityPart);
                return;
            }

            var yearsOld = pawn.ageTracker.AgeBiologicalYearsFloat;

            if (yearsOld < SettingHelper.latest.PubertyOnset)
            {
                var dif = pawn.health.AddHediff(HediffDefOf.LifeStages_Youth, maturityPart, null);
                dif.Severity = 1f / (1 + yearsOld);
            }
            else if (yearsOld < SettingHelper.latest.PubertyOnset + 1)
            {
                pawn.health.AddHediff(HediffDefOf.LifeStages_Puberty, maturityPart, null);
            }
            else
            {
                DoPuberty(pawn, maturityPart);
            }
        }
예제 #2
0
        public static void applyPubertyDay(Pawn pawn, float severity)
        {
            if (!Recipe_Neuter.PartsToApplyOn(pawn).Any())
            {
                return;
            }

            RacePubertySetting pubertySettings = pawn.RacePubertySetting();

            var sexOrgans = pubertySettings.RelaventHeDiffs(pawn.health.hediffSet);

            if (sexOrgans.Any())
            {
                ChestManager.pubertyChest(pawn, severity, pubertySettings);
                pubertySettings.DecideTooAddHair(pawn);
            }
            else
            {
                pubertySettings.roleOrganMaturity(pawn, severity);
            }
        }