コード例 #1
0
        internal static void _GeneratePawn(ref PawnGenerationRequest request, ref Pawn __result)
        {
            Pawn pawn = __result;

            // Children hediff being injected
            if (pawn.ageTracker.CurLifeStageIndex <= 2 && pawn.kindDef.race == ThingDefOf.Human)
            {
                // Clean out drug randomly generated drug addictions
                pawn.health.hediffSet.Clear();
                pawn.health.AddHediff(HediffDef.Named("BabyState"), null, null);
                if (pawn.Dead)
                {
                    Log.Error(pawn.NameStringShort + " died on generation. This is caused by a mod conflict. Disable any conflicting mods before running Children & Pregnancy.");
                }
                Hediff_Baby babystate = (Hediff_Baby)pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("BabyState"));
                if (babystate != null)
                {
                    for (int i = 0; i != pawn.ageTracker.CurLifeStageIndex + 1; i++)
                    {
                        babystate.GrowUpTo(i, true);
                    }
                }
                if (pawn.ageTracker.CurLifeStageIndex == 2 && pawn.ageTracker.AgeBiologicalYears < 10)
                {
                    pawn.story.childhood = BackstoryDatabase.allBackstories ["CustomBackstory_NA_Childhood"];
                }
            }
        }
コード例 #2
0
            internal static void _GeneratePawn(ref PawnGenerationRequest request, ref Pawn __result)
            {
                Pawn pawn = __result;

                if (pawn.ageTracker.CurLifeStageIndex <= AgeStage.Child && ChildrenUtility.RaceUsesChildren(pawn))
                {
                    // hostile children on/off
                    if (!BnC_Settings.option_hostile_children_raider && Faction.OfPlayerSilentFail != null)
                    {
                        if (pawn.Faction != null && pawn.HostileTo(Faction.OfPlayer))
                        {
                            Log.Message("[From BnC] hostile children growup : " + pawn.LabelIndefinite());
                            ChildrenUtility.GrowupHostileChild(ref request, ref pawn);
                            return;
                        }
                    }

                    // give innocence trait
                    ChildrenUtility.Give_Innocent_trait(ref pawn);
                    // give backstory
                    if (pawn.ageTracker.CurLifeStageIndex == 2 && pawn.ageTracker.AgeBiologicalYears < 8 && ChildrenUtility.IsHumanlikeChild(pawn))
                    {
                        pawn.story.childhood = BackstoryDatabase.allBackstories["CustomBackstory_NA_Childhood"];
                    }

                    if (pawn.ageTracker.CurLifeStageIndex == AgeStage.Baby)
                    {
                        // if rjw is on return
                        if (AnotherModCheck.RJW_On)
                        {
                            return;
                        }
                    }

                    // Children hediff being injected
                    pawn.health.AddHediff(HediffDef.Named("BabyState"), null, null);
                    Hediff_Baby babystate = (Hediff_Baby)pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("BabyState"));
                    if (babystate != null)
                    {
                        for (int i = 0; i != pawn.ageTracker.CurLifeStageIndex + 1; i++)
                        {
                            babystate.GrowUpTo(i, true);
                        }
                    }
                }
            }