Пример #1
0
        // My own methods
        internal static Graphic GetChildHeadGraphics(PawnGraphicSet graphicSet, Shader shader, Color skinColor)
        {
            Graphic_Multi graphic = null;
            Pawn          pawn    = graphicSet.pawn;

            if (ChildrenUtility.IsHumanlikeChild(pawn))
            {
                string str  = "Male_Child";
                string path = "Things/Pawn/Humanlike/Children/Heads/" + str;
                graphic = GraphicDatabase.Get <Graphic_Multi>(path, shader, Vector2.one, skinColor) as Graphic_Multi;
            }
            else
            {
                graphic = graphicSet.headGraphic as Graphic_Multi;
            }
            return(graphic);
        }
Пример #2
0
        internal static Graphic GetChildBodyGraphics(PawnGraphicSet graphicSet, Shader shader, Color skinColor)
        {
            Graphic_Multi graphic = null;
            Pawn          pawn    = graphicSet.pawn;

            if (ChildrenUtility.IsHumanlikeChild(pawn))
            {
                string str = "Naked_Boy";
                if (graphicSet.pawn.gender == Gender.Female)
                {
                    str = "Naked_Girl";
                }
                string path = "Things/Pawn/Humanlike/Children/Bodies/" + str;
                graphic = GraphicDatabase.Get <Graphic_Multi>(path, shader, Vector2.one, skinColor) as Graphic_Multi;
            }
            else
            {
                graphic = graphicSet.nakedGraphic as Graphic_Multi;
            }
            return(graphic);
        }
Пример #3
0
        internal void GrowUpTo(int stage, bool generated)
        {
            grown_to           = stage;
            accelerated_factor = ChildrenUtility.Setting_Accelerated_Factor(grown_to);

            // Update the Colonist Bar
            PortraitsCache.SetDirty(pawn);
            LongEventHandler.ExecuteWhenFinished(delegate {
                pawn.Drawer.renderer.graphics.ResolveAllGraphics();
            });

            // At the toddler stage. Now we can move and talk.
            if (stage == 1)
            {
                Severity = Math.Max(0.5f, Severity);
                //pawn.needs.food.
            }
            // Re-enable skills that were locked out from toddlers
            if (stage == 2)
            {
                if (!generated && ChildrenUtility.IsHumanlikeChild(pawn))
                {
                    pawn.story.childhood = BackstoryDatabase.allBackstories["CustomBackstory_Rimchild"];
                }
                if (!generated && !ChildrenUtility.IsHumanlikeChild(pawn))
                {
                    ChildrenUtility.GiveBackstory(ref pawn);
                }

                // Remove the hidden hediff stopping pawns from manipulating
                if (pawn.health.hediffSet.HasHediff(HediffDef.Named("NoManipulationFlag")))
                {
                    pawn.health.hediffSet.hediffs.Remove(pawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("NoManipulationFlag")));
                }
                Severity = Math.Max(0.75f, Severity);
            }
            // The child has grown to a teenager so we no longer need this effect
            if (stage == 3)
            {
                if (!generated && pawn.story.childhood.title == "Child")
                {
                    pawn.story.childhood = BackstoryDatabase.allBackstories ["CustomBackstory_Rimchild"];
                }

                // Gain traits from life experiences
                if (pawn.story.traits.allTraits.Count < 3)
                {
                    List <Trait> life_traitpool = new List <Trait>();
                    // Try get cannibalism
                    if (pawn.needs.mood.thoughts.memories.Memories.Find(x => x.def == ThoughtDefOf.AteHumanlikeMeatAsIngredient) != null)
                    {
                        life_traitpool.Add(new Trait(TraitDefOf.Cannibal, 0, false));
                    }
                    // Try to get bloodlust
                    if (pawn.records.GetValue(RecordDefOf.KillsHumanlikes) > 0 || pawn.records.GetValue(RecordDefOf.AnimalsSlaughtered) >= 2)
                    {
                        life_traitpool.Add(new Trait(TraitDefOf.Bloodlust, 0, false));
                    }
                    // Try to get shooting accuracy
                    if (pawn.records.GetValue(RecordDefOf.ShotsFired) > 100)
                    {
                        life_traitpool.Add(new Trait(TraitDef.Named("ShootingAccuracy"), 1, false));
                    }
                    else if (pawn.records.GetValue(RecordDefOf.ShotsFired) > 100 && (int)pawn.records.GetValue(RecordDefOf.PawnsDowned) == 0)
                    {
                        life_traitpool.Add(new Trait(TraitDef.Named("ShootingAccuracy"), -1, false));
                    }
                    // Try to get brawler
                    else if (pawn.records.GetValue(RecordDefOf.ShotsFired) < 15 && pawn.records.GetValue(RecordDefOf.PawnsDowned) > 1)
                    {
                        life_traitpool.Add(new Trait(TraitDefOf.Brawler, 0, false));
                    }
                    // Try to get Dislikes Men/Women
                    int male_rivals   = 0;
                    int female_rivals = 0;
                    foreach (Pawn colinist in Find.AnyPlayerHomeMap.mapPawns.AllPawnsSpawned)
                    {
                        if (pawn.relations.OpinionOf(colinist) <= -20)
                        {
                            if (colinist.gender == Gender.Male)
                            {
                                male_rivals++;
                            }
                            else
                            {
                                female_rivals++;
                            }
                        }
                    }
                    // Find which gender we hate
                    if (male_rivals > 3 || female_rivals > 3)
                    {
                        if (male_rivals > female_rivals)
                        {
                            life_traitpool.Add(new Trait(TraitDefOf.DislikesMen, 0, false));
                        }
                        else if (female_rivals > male_rivals)
                        {
                            life_traitpool.Add(new Trait(TraitDefOf.DislikesWomen, 0, false));
                        }
                    }
                    // Pyromaniac never put out any fires. Seems kinda stupid

                    /*if ((int)pawn.records.GetValue (RecordDefOf.FiresExtinguished) == 0) {
                     *      life_traitpool.Add (new Trait (TraitDefOf.Pyromaniac, 0, false));
                     * }*/
                    // Neurotic
                    if (pawn.records.GetValue(RecordDefOf.TimesInMentalState) > 6)
                    {
                        life_traitpool.Add(new Trait(TraitDef.Named("Neurotic"), 2, false));
                    }
                    else if (pawn.records.GetValue(RecordDefOf.TimesInMentalState) > 3)
                    {
                        life_traitpool.Add(new Trait(TraitDef.Named("Neurotic"), 1, false));
                    }

                    // Girls can turn gay during puberty
                    if (pawn.gender == Gender.Female && Rand.Value <= 0.08f && pawn.story.traits.allTraits.Count <= 3)
                    {
                        pawn.story.traits.GainTrait(new Trait(TraitDefOf.Gay, 0, true));
                    }

                    // Now let's try to add some life experience traits
                    if (life_traitpool.Count > 0)
                    {
                        int i = 3;
                        while (pawn.story.traits.allTraits.Count < 3 && i > 0)
                        {
                            Trait newtrait = life_traitpool.RandomElement();
                            if (pawn.story.traits.HasTrait(newtrait.def) == false)
                            {
                                pawn.story.traits.GainTrait(newtrait);
                            }
                            i--;
                        }
                    }
                }

                pawn.health.RemoveHediff(this);
            }
        }
Пример #4
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);
                        }
                    }
                }
            }