Example #1
0
        public static bool TryGetChaosOverlayGraphics(Pawn pawn, out Graphic headgraphic, out Graphic bodygraphic)
        {
            if (pawn.needs != null && pawn.story != null && !pawn.kindDef.factionLeader && pawn.Drawer.renderer.graphics.AllResolved)
            {
                Need_Soul soul = pawn.needs.TryGetNeed <Need_Soul>();
                if (soul != null && !soul.NoPatron && soul.patronInfo.PatronName != "Slaanesh")
                {
                    headgraphic = AfflictionDrawerUtility.GetHeadGraphic(pawn, soul.patronInfo.PatronName);
                    bodygraphic = AfflictionDrawerUtility.GetBodyOverlay(pawn.story.bodyType, soul.patronInfo.PatronName);
                    return(true);
                }
            }

            headgraphic = null;
            bodygraphic = null;
            return(false);
        }
        public static bool TryGetAfflictionDrawer(Pawn pawn, Need_Soul soul, string patronName, BodyType bodyType, out ApparelGraphicRecord recBody, out ApparelGraphicRecord recHead, out ApparelGraphicRecord recHair)
        {
            if (bodyType == BodyType.Undefined)
            {
                Log.Error("Getting overlay graphic with undefined body type.");
                bodyType = BodyType.Male;
            }
            soul = pawn.needs.TryGetNeed <Need_Soul>();
            Graphic headgraphic    = AfflictionDrawerUtility.GetHeadGraphic(pawn, patronName);
            Graphic bodygraphic    = AfflictionDrawerUtility.GetBodyOverlay(pawn.story.BodyType, patronName);
            string  hairpath       = pawn.Drawer.renderer.graphics.hairGraphic.path;
            Graphic oldhairgraphic = GraphicDatabase.Get <Graphic_Multi>(hairpath, ShaderDatabase.Cutout, Vector2.one, pawn.story.hairColor);
            Apparel temp1          = new Apparel();
            Apparel temp2          = new Apparel();
            Apparel temp3          = new Apparel();

            temp1.def = CorruptionDefOfs.Overlay_Head;
            temp2.def = CorruptionDefOfs.Overlay_Hair;
            temp3.def = AfflictionDrawerUtility.GetOverlayDef(patronName);
            recHead   = new ApparelGraphicRecord(headgraphic, temp1);
            recHair   = new ApparelGraphicRecord(oldhairgraphic, temp2);
            recBody   = new ApparelGraphicRecord(bodygraphic, temp3);
            return(true);
        }