public static bool Prefix(PawnGraphicSet __instance) { if (__instance.pawn.def is RaceAddonThingDef thingDef) { Pawn pawn = __instance.pawn; RaceAddonComp racomp = pawn.GetComp <RaceAddonComp>(); if (racomp.raceAddonGraphicSet == null) { racomp.raceAddonGraphicSet = new RaceAddonGraphicSet(pawn, racomp); } TorsoDef torsoDef = racomp.torsoDef; __instance.ClearCache(); RenewalBodyGraphic(__instance, torsoDef.bodyPath.normal, torsoDef.shaderType.Shader, racomp, thingDef.raceAddonSettings.graphicSetting.rottingColor); RenewalHeadGraphic(__instance, torsoDef.headPath.normal, torsoDef.shaderType.Shader, racomp, thingDef.raceAddonSettings.graphicSetting.rottingColor); __instance.dessicatedGraphic = GraphicDatabase.Get <Graphic_Multi>(torsoDef.bodyType.bodyDessicatedGraphicPath, ShaderDatabase.Cutout); __instance.skullGraphic = GraphicDatabase.Get <Graphic_Multi>(torsoDef.skullPath, ShaderDatabase.Cutout); __instance.headStumpGraphic = GraphicDatabase.Get <Graphic_Multi>(torsoDef.stumpPath, torsoDef.shaderType.Shader, Vector2.one, racomp.skinColor_Main, racomp.skinColor_Sub); __instance.desiccatedHeadStumpGraphic = GraphicDatabase.Get <Graphic_Multi>(torsoDef.stumpPath, torsoDef.shaderType.Shader, Vector2.one, thingDef.raceAddonSettings.graphicSetting.rottingColor); if (pawn.story.hairDef is ImprovedHairDef hairDef) { __instance.hairGraphic = GraphicDatabase.Get <Graphic_Multi>(hairDef.texPath, hairDef.shaderType.Shader, Vector2.one, pawn.story.hairColor, racomp.hairColor_Sub); racomp.raceAddonGraphicSet.hairGraphic = GraphicDatabase.Get <Graphic_Multi>(hairDef.lowerPath, hairDef.shaderType.Shader, Vector2.one, pawn.story.hairColor, racomp.hairColor_Sub); } else { __instance.hairGraphic = GraphicDatabase.Get <Graphic_Multi>(pawn.story.hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, pawn.story.hairColor); racomp.raceAddonGraphicSet.hairGraphic = null; } __instance.ResolveApparelGraphics(); return(false); } return(true); }
public static bool ResolveAllGraphicsWereWolf(PawnGraphicSet __instance) { if (Current.ProgramState != ProgramState.Playing) { return(true); } var pawn = Traverse.Create(__instance).Field("pawn").GetValue <Pawn>(); if (!pawn.Spawned) { return(true); } var compWerewolf = pawn.GetComp <CompWerewolf>(); if (compWerewolf == null || !compWerewolf.IsTransformed) { return(true); } compWerewolf.CurrentWerewolfForm.bodyGraphicData = compWerewolf.CurrentWerewolfForm.def.graphicData; __instance.nakedGraphic = compWerewolf.CurrentWerewolfForm.bodyGraphicData.Graphic; __instance.ResolveApparelGraphics(); PortraitsCache.SetDirty(pawn); return(false); }
public static void Vamp_ResolveAllGraphics(PawnGraphicSet __instance) { if (__instance?.pawn?.VampComp() is CompVampire v && v.IsVampire && !v.Transformed) { if (v?.Bloodline?.nakedBodyGraphicsPath != "") { Graphic newBodyGraphic = VampireGraphicUtility.GetNakedBodyGraphic(__instance.pawn, __instance.pawn.story.bodyType, ShaderDatabase.CutoutSkin, __instance.pawn.story.SkinColor); if (newBodyGraphic != null) { __instance.nakedGraphic = newBodyGraphic; } } if (v?.Bloodline?.headGraphicsPath != "") { string headPath = VampireGraphicUtility.GetHeadGraphicPath(__instance.pawn); if (headPath != "") { Graphic newHeadGraphic = VampireGraphicUtility.GetVampireHead(__instance.pawn, headPath, __instance.pawn.story.SkinColor); if (newHeadGraphic != null) { __instance.headGraphic = newHeadGraphic; } } } __instance.ResolveApparelGraphics(); } }
internal static void _ResolveAllGraphics(this PawnGraphicSet _this) { _this.ClearCache(); if (_this.pawn.RaceProps.Humanlike) { ResolveAgeGraphics(_this); _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); } } }
internal static void ResolveAllGraphics_Patch(ref PawnGraphicSet __instance) { Pawn pawn = __instance.pawn; if (pawn.RaceProps.Humanlike) { Children_Drawing.ResolveAgeGraphics(__instance); __instance.ResolveApparelGraphics(); } }
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(); }); } }
private static bool Prefix(PawnGraphicSet __instance) { if (__instance.pawn.def is RaceAddonThingDef thingDef) { Pawn pawn = __instance.pawn; RaceAddonComp racomp = pawn.GetComp <RaceAddonComp>(); racomp.drawSize = RaceAddonTools.GetPawnDrawSize(pawn, thingDef); var drawSize = thingDef.raceAddonSettings.graphicSetting.drawSize[racomp.drawSize]; // cleaning __instance.ClearCache(); // resolve mesh set racomp.bodyMeshSet = new GraphicMeshSet(1.5f * drawSize.bodySize.x, 1.5f * drawSize.bodySize.y); racomp.headMeshSet = new GraphicMeshSet(1.5f * drawSize.headSize.x, 1.5f * drawSize.headSize.y); racomp.equipmentMeshSet = new GraphicMeshSet(drawSize.equipmentSize.x, drawSize.equipmentSize.y); // resolve body var bodyDef = racomp.savedBodyData.def; __instance.pawn.story.bodyType = bodyDef.bodyTypeDef; __instance.nakedGraphic = GraphicDatabase.Get <Graphic_Multi> (GetBodyNormalPath(bodyDef), bodyDef.shaderType.Shader, Vector2.one, pawn.story.SkinColor, racomp.savedSkinData.color2); __instance.rottingGraphic = GraphicDatabase.Get <Graphic_Multi> (GetBodyNormalPath(bodyDef), bodyDef.shaderType.Shader, Vector2.one, racomp.savedSkinData.rottingColor); __instance.dessicatedGraphic = GraphicDatabase.Get <Graphic_Multi>(GetBodySkullPath(bodyDef), ShaderDatabase.Cutout); // resolve head var headDef = racomp.savedHeadData.def; __instance.pawn.story.crownType = headDef.crownType; __instance.headGraphic = GraphicDatabase.Get <Graphic_Multi> (headDef.replacedHeadPath, headDef.shaderType.Shader, Vector2.one, pawn.story.SkinColor, racomp.savedSkinData.color2); __instance.desiccatedHeadGraphic = GraphicDatabase.Get <Graphic_Multi> (headDef.replacedHeadPath, headDef.shaderType.Shader, Vector2.one, racomp.savedSkinData.rottingColor); __instance.skullGraphic = GraphicDatabase.Get <Graphic_Multi> (headDef.replacedSkullPath, headDef.shaderType.Shader, Vector2.one, Color.white); // resolve stump __instance.headStumpGraphic = GraphicDatabase.Get <Graphic_Multi> (headDef.replacedStumpPath, headDef.shaderType.Shader, Vector2.one, pawn.story.SkinColor, racomp.savedSkinData.color2); __instance.desiccatedHeadStumpGraphic = GraphicDatabase.Get <Graphic_Multi> (headDef.replacedStumpPath, headDef.shaderType.Shader, Vector2.one, racomp.savedSkinData.rottingColor); // resolve hair HairDef hairDef = pawn.story.hairDef; if (hairDef is ImprovedHairDef advancedHairDef) { __instance.hairGraphic = GraphicDatabase.Get <Graphic_Multi> (advancedHairDef.texPath, advancedHairDef.shaderType.Shader, Vector2.one, pawn.story.hairColor, racomp.savedHairData.color2); if (advancedHairDef.lowerPath != null) { racomp.improvedHairGraphic = GraphicDatabase.Get <Graphic_Multi> (advancedHairDef.lowerPath, advancedHairDef.shaderType.Shader, Vector2.one, pawn.story.hairColor, racomp.savedHairData.color2); } } else { __instance.hairGraphic = GraphicDatabase.Get <Graphic_Multi> (hairDef.texPath, ShaderDatabase.Cutout, Vector2.one, pawn.story.hairColor); racomp.improvedHairGraphic = null; } // resolve upper face if (racomp.savedFaceData != null && racomp.savedFaceData.upperDef != null) { var upperFaceDef = racomp.savedFaceData.upperDef; racomp.upperFaceGraphicSet = new FaceGraphicSet(pawn, racomp.savedFaceData, upperFaceDef, racomp); racomp.upperFaceGraphicSet.ResolveAllGraphics(); } // resolve lower face if (racomp.savedFaceData != null && racomp.savedFaceData.lowerDef != null) { var lowerFaceDef = racomp.savedFaceData.lowerDef; racomp.lowerFaceGraphicSet = new FaceGraphicSet(pawn, racomp.savedFaceData, lowerFaceDef, racomp); racomp.lowerFaceGraphicSet.ResolveAllGraphics(); } // resolve addons if (racomp.savedAddonDatas != null) { racomp.bodyAddonGraphicSets = null; racomp.headAddonGraphicSets = null; foreach (var data in racomp.savedAddonDatas) { if (data.def.drawingToBody) { if (racomp.bodyAddonGraphicSets == null) { racomp.bodyAddonGraphicSets = new List <AddonGraphicSet>(); } var set = new AddonGraphicSet(data); set.ResolveAllGraphics(racomp.savedSkinData.rottingColor, pawn.health.hediffSet); racomp.bodyAddonGraphicSets.Add(set); } else { if (racomp.headAddonGraphicSets == null) { racomp.headAddonGraphicSets = new List <AddonGraphicSet>(); } var set = new AddonGraphicSet(data); set.ResolveAllGraphics(racomp.savedSkinData.rottingColor, pawn.health.hediffSet); racomp.headAddonGraphicSets.Add(set); } } } if (!pawn.Dead) { // resolve eye blinker if (thingDef.raceAddonSettings.graphicSetting.eyeBlink) { racomp.eyeBlinker = new EyeBlinker(); racomp.eyeBlinker.Check(pawn.needs.mood.CurLevel); } // resolve head rotator if (thingDef.raceAddonSettings.graphicSetting.headAnimation) { racomp.headRotator = new HeadRotator(); racomp.headRotator.Check(); } // resolve head targeter if (thingDef.raceAddonSettings.graphicSetting.headTargeting) { racomp.headTargeter = new HeadTargeter(__instance.pawn); racomp.headTargeter.Check(); } } // resolve apparel __instance.ResolveApparelGraphics(); return(false); } return(true); }