mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	While I'm at it, add an allanuses hashset.
This commit is contained in:
		
							parent
							
								
									6b585afa86
								
							
						
					
					
						commit
						e9671624c0
					
				
					 3 changed files with 26 additions and 2 deletions
				
			
		| 
						 | 
					@ -273,7 +273,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static Texture2D GetAnalIcon(this Pawn pawn, bool drawOrigin = false)
 | 
					        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<Texture2D>.Get(("Genitals/Anal00"), true);
 | 
					            if (hediff == null) return ContentFinder<Texture2D>.Get(("Genitals/Anal00"), true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            string icon;
 | 
					            string icon;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -331,7 +331,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        public static string GetAnusLabel(this Pawn pawn)
 | 
					        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 + ")";
 | 
					            if (hediff != null) return hediff.LabelBase.CapitalizeFirst() + "\n(" + hediff.LabelInBrackets + ")";
 | 
				
			||||||
            else return "";
 | 
					            else return "";
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -50,6 +50,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
        private static List<ThingDef> allraces = null;
 | 
					        private static List<ThingDef> allraces = null;
 | 
				
			||||||
        private static List<PawnKindDef> allkinds = null;
 | 
					        private static List<PawnKindDef> allkinds = null;
 | 
				
			||||||
        private static HashSet<HediffDef> allvaginas = null;
 | 
					        private static HashSet<HediffDef> allvaginas = null;
 | 
				
			||||||
 | 
					        private static HashSet<HediffDef> allanuses = null;
 | 
				
			||||||
        private static HashSet<HediffDef> allbreasts = null;
 | 
					        private static HashSet<HediffDef> allbreasts = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static List<ThingDef> AllRaces
 | 
					        public static List<ThingDef> AllRaces
 | 
				
			||||||
| 
						 | 
					@ -97,6 +98,29 @@ namespace RJW_Menstruation
 | 
				
			||||||
                return allvaginas;
 | 
					                return allvaginas;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        public static HashSet<HediffDef> AllAnuses
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            get
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                if (allanuses != null) return allanuses;
 | 
				
			||||||
 | 
					                allanuses = new HashSet<HediffDef>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                foreach (HediffDef hediffDef in DefDatabase<HediffDef>.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<HediffDef> AllBreasts
 | 
					        public static HashSet<HediffDef> AllBreasts
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            get
 | 
					            get
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue