Example #1
0
 public void ResolveAllGraphicsAlien()
 {
     this.ClearCache();
     if (this.pawn.RaceProps.Humanlike)
     {
         this.nakedGraphic          = GraphicGetter_NakedAlien.GetNakedBodyGraphicAlien(this.pawn.story.BodyType, ShaderDatabase.CutoutSkin, this.pawn.story.SkinColor, ThingDef_AlienRace.);
         this.rottingGraphic        = GraphicGetter_NakedHumanlike.GetNakedBodyGraphic(this.pawn.story.BodyType, ShaderDatabase.CutoutSkin, PawnGraphicSet.RottingColor);
         this.dessicatedGraphic     = GraphicDatabase.Get <Graphic_Multi>("Things/Pawn/Humanlike/HumanoidDessicated", ShaderDatabase.Cutout);
         this.headGraphic           = GraphicDatabaseHeadRecords.GetHeadNamed(this.pawn.story.HeadGraphicPath, this.pawn.story.SkinColor);
         this.desiccatedHeadGraphic = GraphicDatabaseHeadRecords.GetHeadNamed(this.pawn.story.HeadGraphicPath, PawnGraphicSet.RottingColor);
         this.skullGraphic          = GraphicDatabaseHeadRecords.GetSkull();
         this.hairGraphic           = GraphicDatabase.Get <Graphic_Multi>(this.pawn.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, this.pawn.story.hairColor);
         this.ResolveApparelGraphics();
     }
     else
     {
         PawnKindLifeStage curKindLifeStage = this.pawn.ageTracker.CurKindLifeStage;
         if (this.pawn.gender != Gender.Female || curKindLifeStage.femaleGraphicData == null)
         {
             this.nakedGraphic = curKindLifeStage.bodyGraphicData.Graphic;
         }
         else
         {
             this.nakedGraphic = curKindLifeStage.femaleGraphicData.Graphic;
         }
         this.rottingGraphic = this.nakedGraphic.GetColoredVersion(ShaderDatabase.CutoutSkin, PawnGraphicSet.RottingColor, PawnGraphicSet.RottingColor);
         if (curKindLifeStage.dessicatedBodyGraphicData != null)
         {
             this.dessicatedGraphic = curKindLifeStage.dessicatedBodyGraphicData.GraphicColoredFor(this.pawn);
         }
     }
 }
Example #2
0
        private void resolveGraphics()
        {
            if (nakedGraphic != null)
            {
                return;
            }

            nakedGraphic = GraphicGetter_NakedHumanlike.GetNakedBodyGraphic(
                bodyType, ShaderDatabase.CutoutSkin, skinColor);

            headGraphic = GraphicDatabaseHeadRecords.GetHeadNamed(
                headGraphicPath, skinColor);

            hairGraphic = GraphicDatabase.Get <Graphic_Multi>(
                hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, hairColor);

            if (apparelDef != null)
            {
                Color color;
                if (Stuff != null)
                {
                    color = Stuff.stuffProps.color;
                }
                else
                {
                    color = Color.white;
                }

                apparelGraphic = new Graphic[apparelDef.Count];
                for (int i = 0; i < apparelDef.Count; i++)
                {
                    apparelGraphic[i] = TryGetGraphicApparel(apparelDef[i], bodyType, color);
                }
            }
        }
 // RimWorld.Pawn_StoryTracker
 public static string GetHeadGraphicPath(Pawn pawn)
 {
     if (pawn.VampComp() is CompVampire v && v.IsVampire && v.Bloodline.headGraphicsPath != "")
     {
         Graphic giggity         = GraphicDatabaseHeadRecords.GetHeadNamed(pawn.story.HeadGraphicPath, pawn.story.SkinColor);
         string  headGraphicPath = giggity.path; //pawn.story.HeadGraphicPath; //Traverse.Create(pawn.story).Field("headGraphicPath").GetValue<string>();
         string  pathToReplace   = "Things/Pawn/Humanlike/Heads/";
         headGraphicPath = headGraphicPath.Replace(pathToReplace, v.Bloodline.headGraphicsPath);
         return(headGraphicPath);
     }
     return("");
 }
Example #4
0
        internal static void ResolveAgeGraphics(PawnGraphicSet graphics)
        {
            // Beards
            String beard = "";

            if (graphics.pawn.story.hairDef.hairTags.Contains("Beard"))
            {
                if (graphics.pawn.apparel.BodyPartGroupIsCovered(BodyPartGroupDefOf.UpperHead))
                {
                    beard = "_BeardOnly";
                }
                if (graphics.pawn.ageTracker.CurLifeStageIndex <= 3)
                {
                    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 <= 1)
            {
                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 == 0)
            {
                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 == 1)
            {
                string upright = "";
                if (graphics.pawn.ageTracker.AgeBiologicalYears >= 2)
                {
                    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 == 2)
            {
                //              graphics.nakedGraphic = ChildGraphics.GetChildBodyGraphics(graphics, ShaderDatabase.CutoutSkin, graphics.pawn.story.SkinColor);
                //              graphics.headGraphic = ChildGraphics.GetChildHeadGraphics(ShaderDatabase.CutoutSkin, graphics.pawn.story.SkinColor);
            }
            // Otherwise, just use the normal methods
            else if (graphics.pawn.ageTracker.CurLifeStageIndex >= 3)
            {
                graphics.nakedGraphic = GraphicGetter_NakedHumanlike.GetNakedBodyGraphic(graphics.pawn.story.bodyType, ShaderDatabase.CutoutSkin, graphics.pawn.story.SkinColor);
                graphics.headGraphic  = GraphicDatabaseHeadRecords.GetHeadNamed(graphics.pawn.story.HeadGraphicPath, graphics.pawn.story.SkinColor);
            }

            graphics.rottingGraphic        = GraphicGetter_NakedHumanlike.GetNakedBodyGraphic(graphics.pawn.story.bodyType, ShaderDatabase.CutoutSkin, PawnGraphicSet.RottingColor);
            graphics.dessicatedGraphic     = GraphicDatabase.Get <Graphic_Multi>("Things/Pawn/Humanlike/HumanoidDessicated", ShaderDatabase.Cutout);
            graphics.desiccatedHeadGraphic = GraphicDatabaseHeadRecords.GetHeadNamed(graphics.pawn.story.HeadGraphicPath, PawnGraphicSet.RottingColor);
            graphics.skullGraphic          = GraphicDatabaseHeadRecords.GetSkull();
        }
Example #5
0
 protected void ResetHead()
 {
     // Need to use reflection to set the private field.
     typeof(Pawn_StoryTracker).GetField("headGraphicPath", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(pawn.story, FilterHeadPathForGender(pawn.story.HeadGraphicPath));
     graphics[PawnLayers.HeadType] = GraphicDatabaseHeadRecords.GetHeadNamed(pawn.story.HeadGraphicPath, pawn.story.SkinColor);
 }
Example #6
0
        public void InitializeWithPawn(Pawn pawn)
        {
            this.pawn = this.CopyPawn(pawn);

            this.birthTicks = this.pawn.ageTracker.BirthAbsTicks % 3600000L;

            // Set the traits.
            this.traits.Clear();
            for (int i = 0; i < TraitCount; i++)
            {
                this.traits.Add(null);
            }
            List <Trait> pawnTraits = pawn.story.traits.allTraits;

            if (pawnTraits.Count > 0)
            {
                this.traits[0] = pawnTraits[0];
            }
            if (pawnTraits.Count > 1 && this.traits[0] != pawnTraits[1])
            {
                this.traits[1] = pawnTraits[1];
            }
            if (pawnTraits.Count > 2 && this.traits[0] != pawnTraits[2] && this.traits[1] != pawnTraits[2])
            {
                this.traits[2] = pawnTraits[2];
            }

            // Set the skills.
            InitializeSkillLevelsAndPassions();
            ComputeSkillLevelModifiers();

            graphics.Clear();
            colors.Clear();
            PawnGraphicSet pawnGraphics = pawn.Drawer.renderer.graphics;

            graphics.Add(GraphicGetter_NakedHumanlike.GetNakedBodyGraphic(pawn.story.BodyType, ShaderDatabase.CutoutSkin, pawn.story.SkinColor));
            colors.Add(pawn.story.SkinColor);

            graphics.Add(null);
            colors.Add(Color.white);
            graphics.Add(null);
            colors.Add(Color.white);
            graphics.Add(null);
            colors.Add(Color.white);
            graphics.Add(null);
            colors.Add(Color.white);

            graphics.Add(GraphicDatabaseHeadRecords.GetHeadNamed(pawn.story.HeadGraphicPath, pawn.story.SkinColor));
            colors.Add(pawn.story.SkinColor);
            ResetHead();

            graphics.Add(GraphicsCache.Instance.GetHair(pawn.story.hairDef));
            colors.Add(pawn.story.hairColor);

            graphics.Add(null);
            colors.Add(Color.white);
            graphics.Add(null);
            colors.Add(Color.white);

            for (int i = 0; i < PawnLayers.Count; i++)
            {
                selectedApparel.Add(null);
                acceptedApparel.Add(null);
                selectedStuff.Add(null);
            }
            foreach (Apparel current in this.pawn.apparel.WornApparel)
            {
                Graphic graphic = GraphicsCache.Instance.GetApparel(current.def, pawn.story.BodyType);
                Color   color   = current.DrawColor;
                int     layer   = PawnLayers.ToPawnLayerIndex(current.def.apparel);
                if (layer != -1)
                {
                    graphics[layer] = graphic;
                    SetSelectedApparel(layer, current.def);
                    acceptedApparel[layer] = current.def;
                    SetSelectedStuff(layer, current.Stuff);
                    if (ApparelIsTintedByDefault(current.def, current.Stuff))
                    {
                        SetColor(layer, color);
                    }
                }
            }

            ResetIncapableOf();
            pawn.health.capacities.Clear();
        }
Example #7
0
 public Graphic_Multi GetHead(string path)
 {
     return(GraphicDatabaseHeadRecords.GetHeadNamed(path, Color.white));
 }