diff --git a/source/SizedApparel/SizedApparelBodyPart.cs b/source/SizedApparel/SizedApparelBodyPart.cs index a9fb936cbac631d8193c2d252cca312a5036ffa7..549f636065ef037fed842d34a01ed39a574a6b3c 100644 --- a/source/SizedApparel/SizedApparelBodyPart.cs +++ b/source/SizedApparel/SizedApparelBodyPart.cs @@ -471,7 +471,7 @@ namespace SizedApparel } } - public bool CheckCanPose(string targetPose, bool checkApparels, bool checkBodyParts, bool mustMatchSize, bool mustMatchBodytype, bool mustMatchRace) + public bool CheckCanPose(string targetPose, bool checkApparels, bool checkBodyParts, bool mustMatchSize, bool mustMatchBodytype) { if (checkApparels) { @@ -480,8 +480,8 @@ namespace SizedApparel } if (checkBodyParts) { - Graphic graphic = GetBodyPartGraphics(false, mustMatchSize, mustMatchBodytype, mustMatchRace); - Graphic graphicH = GetBodyPartGraphics(true, mustMatchSize, mustMatchBodytype, mustMatchRace); + Graphic graphic = GetBodyPartGraphics(false, mustMatchSize, mustMatchBodytype); + Graphic graphicH = GetBodyPartGraphics(true, mustMatchSize, mustMatchBodytype); if (graphic != null || graphicH != null) return true; return false; @@ -629,22 +629,21 @@ namespace SizedApparel } - public Graphic GetBodyPartGraphics(bool isHorny, bool mustMatchSize = false, bool mustMatchBodytype = false, bool mustMatchRace = false, string poseOverride = null, string variationOverride = null) + public Graphic GetBodyPartGraphics(bool isHorny, bool mustMatchSize = false, bool mustMatchBodytype = false, string poseOverride = null, string variationOverride = null) { SizedApparelTexturePointDef var; - return GetBodyPartGraphics(isHorny, out var, mustMatchBodytype, mustMatchSize, mustMatchRace, poseOverride, variationOverride); + return GetBodyPartGraphics(isHorny, out var, mustMatchBodytype, mustMatchSize, poseOverride, variationOverride); } - public Graphic GetBodyPartGraphics(bool isHorny, out SizedApparelTexturePointDef outPoints, bool mustMatchSize = false, bool mustMatchBodyType = false , bool mustMatchRace = false ,string poseOverride = null, string variationOverride = null) + public Graphic GetBodyPartGraphics(bool isHorny, out SizedApparelTexturePointDef outPoints, bool mustMatchSize = false, bool mustMatchBodyType = false, string poseOverride = null, string variationOverride = null) { if (pawn == null) { outPoints = null; return null; } - var comp = apparelRecorderCompCache; - if (comp == null) - comp = SizedApparelsDatabase.GetApparelCompFast(pawn); + + var comp = apparelRecorderCompCache ?? SizedApparelsDatabase.GetApparelCompFast(pawn); if (comp == null) { outPoints = null; @@ -653,11 +652,20 @@ namespace SizedApparel string bodyTypeString = pawn.story?.bodyType?.defName; - var key = new SizedApparelsDatabase.BodyPartDatabaseKey(pawn.def.defName, bodyTypeString, currentHediffName, customPath==null?bodyPartName: customPath, pawn.gender, Math.Min(currentSeverityInt, cappedSeverityInt), isHorny, poseOverride==null?customPose:poseOverride, variationOverride==null?variation: variationOverride); - var result = SizedApparelsDatabase.GetSupportedBodyPartPath(key, isBreast, customPath == null ? bodyPartName : customPath, defaultHediffName); - - - + string folderName = customPath ?? bodyPartName; + SizedApparelsDatabase.BodyPartDatabaseKey key; + SizedApparelsDatabase.PathAndSize result = new(null, -1); + if (pawn.IsMutant) + { + var raceAndMutantDefName = pawn.def.defName + "_" + pawn.mutant.def.defName; + key = new(raceAndMutantDefName, bodyTypeString, currentHediffName, folderName, pawn.gender, Math.Min(currentSeverityInt, cappedSeverityInt), isHorny, poseOverride ?? customPose, variationOverride ?? variation); + result = SizedApparelsDatabase.GetSupportedBodyPartPath(key, isBreast, folderName, defaultHediffName); + } + if (result.pathWithSizeIndex == null) + { + key = new(pawn.def.defName, bodyTypeString, currentHediffName, folderName, pawn.gender, Math.Min(currentSeverityInt, cappedSeverityInt), isHorny, poseOverride ?? customPose, variationOverride ?? variation); + result = SizedApparelsDatabase.GetSupportedBodyPartPath(key, isBreast, folderName, defaultHediffName); + } if (mustMatchSize) if (Math.Min(currentSeverityInt, cappedSeverityInt) != result.size) @@ -667,15 +675,7 @@ namespace SizedApparel } if (mustMatchBodyType) { - if(result.bodyType != pawn.story?.bodyType?.defName) - { - outPoints = null; - return null; - } - } - if (mustMatchRace) - { - if (result.raceName != pawn.def.defName) + if (result.bodyType != pawn.story?.bodyType?.defName) { outPoints = null; return null; diff --git a/source/SizedApparel/SizedApparelComp.cs b/source/SizedApparel/SizedApparelComp.cs index 5e86e5463a0e6a3c64b64fd5f1fcd0f8d81a8f91..f9b5bdefdb60866b215275e616dcd986363754a7 100644 --- a/source/SizedApparel/SizedApparelComp.cs +++ b/source/SizedApparel/SizedApparelComp.cs @@ -464,7 +464,7 @@ namespace SizedApparel bool flag2 = true; if (flag2 && checkApparelForCanPose) { - if (!a.CheckCanPose("JiggleUp", true, false, true, true, false)) + if (!a.CheckCanPose("JiggleUp", true, false, true, true)) return; flag2 = false; } diff --git a/source/SizedApparel/SizedApparelsDatabase.cs b/source/SizedApparel/SizedApparelsDatabase.cs index 378430e46d7b4ca78318568ea00bd698d5582820..3bb059fa67bf33827af9bfd7c9f99bc94b20da9d 100644 --- a/source/SizedApparel/SizedApparelsDatabase.cs +++ b/source/SizedApparel/SizedApparelsDatabase.cs @@ -413,7 +413,7 @@ namespace SizedApparel //HumanLike Search AlienRaceSetting raceSetting; raceSetting = SizedApparelSettings.alienRaceSettings.FirstOrDefault((AlienRaceSetting s) => s.raceName == key.raceName); - if (raceSetting !=null && (key.raceName == "Human" || !raceSetting.asHuman)) //old: !SizedApparelSettings.UnsupportedRaceToUseHumanlike + if (raceSetting ==null || key.raceName == "Human" || !raceSetting.asHuman) { //Cannot find Any result result = new PathAndSize(null, -1);