internal static void ApparelChanged_Postfix(ref Pawn_ApparelTracker __instance)
        {
            Pawn_ApparelTracker _this = __instance;

            LongEventHandler.ExecuteWhenFinished(delegate {
                Children_Drawing.ResolveAgeGraphics(_this.pawn.Drawer.renderer.graphics);
            });
        }
Esempio n. 2
0
 public static void Postfix(PawnRenderer __instance, ref Vector3 rootLoc, float angle, bool renderBody, Rot4 bodyFacing, Rot4 headFacing, RotDrawMode bodyDrawType, bool portrait, bool headStump)
 {
     if (AnotherModCheck.ShowHair_On)
     {
         Pawn pawn = (Pawn)PawnFI.GetValue(__instance);
         rootLoc = Children_Drawing.ModifyChildYPosOffset(rootLoc, pawn, portrait);
     }
 }
        internal static void ResolveApparelGraphics_Patch(ref PawnGraphicSet __instance)
        {
            Pawn pawn = __instance.pawn;

            // Updates the beard
            if (pawn.apparel.BodyPartGroupIsCovered(BodyPartGroupDefOf.UpperHead) && pawn.RaceProps.Humanlike)
            {
                Children_Drawing.ResolveAgeGraphics(__instance);
            }
        }
        internal static void ResolveAllGraphics_Patch(ref PawnGraphicSet __instance)
        {
            Pawn pawn = __instance.pawn;

            if (pawn.RaceProps.Humanlike)
            {
                Children_Drawing.ResolveAgeGraphics(__instance);
                __instance.ResolveApparelGraphics();
            }
        }
Esempio n. 5
0
        internal static void ResolveAllGraphics_Patch(ref PawnGraphicSet __instance)
        {
            Pawn           pawn  = __instance.pawn;
            PawnGraphicSet _this = __instance;

            if (pawn.RaceProps.Humanlike)
            {
                Children_Drawing.ResolveAgeGraphics(__instance);
                LongEventHandler.ExecuteWhenFinished(delegate {
                    _this.ResolveApparelGraphics();
                });
            }
        }
        internal static void ResolveAgeGraphics(PawnGraphicSet graphics)
        {
            LongEventHandler.ExecuteWhenFinished(delegate {
                //if (!graphics.pawn.RaceProps.Humanlike) {
                if (graphics.pawn.def.defName != "Human")
                {
                    return;
                }

                // Beards
                String beard = "";
                if (graphics.pawn.story.hairDef != null)
                {
                    if (graphics.pawn.story.hairDef.hairTags.Contains("Beard"))
                    {
                        if (graphics.pawn.apparel.BodyPartGroupIsCovered(BodyPartGroupDefOf.UpperHead) && !graphics.pawn.story.hairDef.hairTags.Contains("DrawUnderHat"))
                        {
                            beard = "_BeardOnly";
                        }
                        if (graphics.pawn.ageTracker.CurLifeStageIndex <= AgeStage.Teenager)
                        {
                            graphics.hairGraphic = GraphicDatabase.Get <Graphic_Multi> (DefDatabase <HairDef> .GetNamed("Mop").texPath, ShaderDatabase.Cutout, Vector2.one, graphics.pawn.story.hairColor);
                        }
                        else
                        {
                            graphics.hairGraphic = GraphicDatabase.Get <Graphic_Multi> (graphics.pawn.story.hairDef.texPath + beard, ShaderDatabase.Cutout, Vector2.one, graphics.pawn.story.hairColor);
                        }
                    }
                    else
                    {
                        graphics.hairGraphic = GraphicDatabase.Get <Graphic_Multi> (graphics.pawn.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, graphics.pawn.story.hairColor);
                    }
                }

                // Reroute the graphics for children
                // For babies and toddlers
                if (graphics.pawn.ageTracker.CurLifeStageIndex <= AgeStage.Baby)
                {
                    string toddler_hair = "Boyish";
                    if (graphics.pawn.gender == Gender.Female)
                    {
                        toddler_hair = "Girlish";
                    }
                    graphics.hairGraphic = GraphicDatabase.Get <Graphic_Multi> ("Things/Pawn/Humanlike/Children/Hairs/Child_" + toddler_hair, ShaderDatabase.Cutout, Vector2.one, graphics.pawn.story.hairColor);
                    graphics.headGraphic = GraphicDatabase.Get <Graphic_Multi> ("Things/Pawn/Humanlike/null", ShaderDatabase.Cutout, Vector2.one, Color.white);

                    // The pawn is a baby
                    if (graphics.pawn.ageTracker.CurLifeStageIndex == AgeStage.Baby)
                    {
                        graphics.nakedGraphic = GraphicDatabase.Get <Graphic_Single> ("Things/Pawn/Humanlike/Children/Bodies/Newborn", ShaderDatabase.CutoutSkin, Vector2.one, graphics.pawn.story.SkinColor);
                    }
                }

                // The pawn is a toddler
                if (graphics.pawn.ageTracker.CurLifeStageIndex == AgeStage.Toddler)
                {
                    string upright = "";
                    if (graphics.pawn.ageTracker.AgeBiologicalYears >= 1)
                    {
                        upright = "Upright";
                    }
                    graphics.nakedGraphic = GraphicDatabase.Get <Graphic_Multi> ("Things/Pawn/Humanlike/Children/Bodies/Toddler" + upright, ShaderDatabase.CutoutSkin, Vector2.one, graphics.pawn.story.SkinColor);
                }
                // The pawn is a child
                else if (graphics.pawn.ageTracker.CurLifeStageIndex == AgeStage.Child)
                {
                    graphics.nakedGraphic = Children_Drawing.GetChildBodyGraphics(graphics, ShaderDatabase.CutoutSkin, graphics.pawn.story.SkinColor);
                    graphics.headGraphic  = Children_Drawing.GetChildHeadGraphics(ShaderDatabase.CutoutSkin, graphics.pawn.story.SkinColor);
                }
            });
        }