Esempio n. 1
0
        private Material OverrideMaterialIfNeeded(Material original, Pawn pawn)
        {
            Material baseMat = pawn.IsInvisible() ? InvisibilityMatPool.GetInvisibleMat(original) : original;

            return(this.graphics.flasher.GetDamagedMat(baseMat));
        }
        public static void DrawBackHairLayer(PawnRenderer __instance,
                                             ref Vector3 rootLoc,
                                             ref float angle,
                                             ref Rot4 headFacing,
                                             ref RotDrawMode bodyDrawType,
                                             ref bool portrait,
                                             ref bool headStump)
        {
            PawnGraphicSet graphics = __instance.graphics;

            if (!graphics.AllResolved)
            {
                graphics.ResolveAllGraphics();
            }
            Graphic_Multi_BHair hairGraphicExtended = graphics.hairGraphic as Graphic_Multi_BHair;

            //if has head and hair graphics
            if (graphics.headGraphic != null && hairGraphicExtended != null)
            {
                Material hairMat = hairGraphicExtended.BackMatAt(headFacing);

                if (hairMat != null)
                {
                    //-------------------------REPLICATED VANILLA CODE-------------------------
                    Quaternion quaternion = Quaternion.AngleAxis(angle, new Vector3(0f, 1f, 0f));
                    Vector3    b          = quaternion * __instance.BaseHeadOffsetAt(headFacing);
                    Vector3    loc2       = rootLoc + b;
                    //-------------------------REPLICATED VANILLA CODE-------------------------


                    //loc2.y -= 0.0303030312f;    //changed from original, used to be +=


                    bool hideHair = false;
                    if (!portrait || !Prefs.HatsOnlyOnMap)
                    {
                        List <ApparelGraphicRecord> apparelGraphics = graphics.apparelGraphics;
                        for (int j = 0; j < apparelGraphics.Count; j++)
                        {
                            if (apparelGraphics[j].sourceApparel.def.apparel.LastLayer == ApparelLayerDefOf.Overhead)
                            {
                                if (!apparelGraphics[j].sourceApparel.def.apparel.hatRenderedFrontOfFace)
                                {
                                    if (HarmonyPatches_BHair.loadedShowHair)
                                    {
                                        hideHair = Compat_ShowHair.SHCompat_ShouldHideHair(graphics.pawn, apparelGraphics[j].sourceApparel.def, portrait);
                                    }
                                    else if (HarmonyPatches_BHair.loadedHatDisplaySelection)
                                    {
                                        hideHair = Compat_HatDisplaySelection.HDCompat_ShouldHideHair(graphics.pawn, apparelGraphics[j].sourceApparel.def.defName);
                                    }
                                    else
                                    {
                                        hideHair = true;
                                    }
                                }
                            }
                        }
                    }

                    if (!hideHair && bodyDrawType != RotDrawMode.Dessicated && !headStump)
                    {
                        if (graphics.pawn.IsInvisible())
                        {
                            hairMat = InvisibilityMatPool.GetInvisibleMat(hairMat);
                        }
                        Material resultMat = graphics.flasher.GetDamagedMat(hairMat);

                        Mesh hairMesh = null;
                        if (HarmonyPatches_BHair.loadedAlienRace)
                        {
                            //use modified hair mesh after processed by Alien Race/Babies And Children
                            hairMesh = Patch_AlienRace.ARCompat_GetCopiedMesh();
                        }

                        if (HarmonyPatches_BHair.loadedRimWorldChildren)
                        {
                            //use modified hair mesh after processed by RimWorldChildren
                            hairMesh  = Patch_RimWorldChildren.RCCompat_GetCopiedMesh();
                            resultMat = Patch_RimWorldChildren.RCCompat_ModifyHairForChild(resultMat, graphics.pawn);

                            //alternate calling method for manual calling
                            //hairMesh = Compat_RimWorldChildren.RCCompat_GetModifiedPawnHairMesh(graphics, graphics.pawn, headFacing);
                        }

                        if (hairMesh == null)
                        {
                            //default
                            hairMesh = graphics.HairMeshSet.MeshAt(headFacing);
                        }

                        GenDraw.DrawMeshNowOrLater(mesh: hairMesh, mat: resultMat, loc: loc2, quat: quaternion, drawNow: portrait);
                    }
                }
            }
        }
Esempio n. 3
0
        public static Material OverrideMaterialIfNeeded(Material original, Pawn pawn)
        {
            Material baseMat = pawn.IsInvisible() ? InvisibilityMatPool.GetInvisibleMat(original) : original;

            return(pawn.Drawer.renderer.graphics.flasher.GetDamagedMat(baseMat));
        }
Esempio n. 4
0
        private static Material OverrideMaterialIfNeeded_NewTemp(PawnGraphicSet graphics, Material original, Pawn pawn, bool portrait = false)
        {
            Material baseMat = (!portrait && pawn.IsInvisible()) ? InvisibilityMatPool.GetInvisibleMat(original) : original;

            return(graphics.flasher.GetDamagedMat(baseMat));
        }