diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs index d5a7ada..7655dc0 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -273,7 +273,7 @@ namespace RJW_Menstruation public static Texture2D GetAnalIcon(this Pawn pawn, bool drawOrigin = false) { - Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault((Hediff h) => h.def.defName.ToLower().Contains("anus")); + Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllAnuses.Contains(h.def)); if (hediff == null) return ContentFinder.Get(("Genitals/Anal00"), true); string icon; diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index a2ba785..71b9f0a 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -331,7 +331,7 @@ namespace RJW_Menstruation } public static string GetAnusLabel(this Pawn pawn) { - Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault((Hediff h) => h.def.defName.ToLower().Contains("anus")); + Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllAnuses.Contains(h.def)); if (hediff != null) return hediff.LabelBase.CapitalizeFirst() + "\n(" + hediff.LabelInBrackets + ")"; else return ""; } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs index 606cb22..5e00858 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs @@ -50,6 +50,7 @@ namespace RJW_Menstruation private static List allraces = null; private static List allkinds = null; private static HashSet allvaginas = null; + private static HashSet allanuses = null; private static HashSet allbreasts = null; public static List AllRaces @@ -97,6 +98,29 @@ namespace RJW_Menstruation return allvaginas; } } + public static HashSet AllAnuses + { + get + { + if (allanuses != null) return allanuses; + allanuses = new HashSet(); + + foreach (HediffDef hediffDef in DefDatabase.AllDefsListForReading) + { + if (hediffDef.comps.NullOrEmpty()) continue; + foreach (HediffCompProperties comp in hediffDef.comps) + { + if (comp.compClass == typeof(HediffComp_Anus) || (comp.compClass?.IsSubclassOf(typeof(HediffComp_Anus)) ?? false)) + { + allanuses.Add(hediffDef); + break; + } + } + } + + return allanuses; + } + } public static HashSet AllBreasts { get