mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Make AllVaginas less hardcoded
This commit is contained in:
		
							parent
							
								
									57998a3895
								
							
						
					
					
						commit
						1125930869
					
				
					 2 changed files with 16 additions and 2 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
using rjw;
 | 
					using rjw;
 | 
				
			||||||
 | 
					using System;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using System.Linq;
 | 
					using System.Linq;
 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
| 
						 | 
					@ -81,9 +82,22 @@ namespace RJW_Menstruation
 | 
				
			||||||
            get
 | 
					            get
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (allvaginas != null) return allvaginas;
 | 
					                if (allvaginas != null) return allvaginas;
 | 
				
			||||||
 | 
					                allvaginas = new HashSet<HediffDef>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                List<HediffDef> allVaginas = DefDatabase<HediffDef>.AllDefsListForReading;
 | 
					                List<HediffDef> allHediffs = DefDatabase<HediffDef>.AllDefsListForReading;
 | 
				
			||||||
                allvaginas = new HashSet<HediffDef>(allVaginas.FindAll(vagina => vagina.HasComp(typeof(HediffComp_Menstruation)) || vagina.HasComp(typeof(HediffComp_InducedOvulator))));
 | 
					                foreach(HediffDef hediffDef in allHediffs)
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    if (hediffDef.comps.NullOrEmpty()) continue;
 | 
				
			||||||
 | 
					                    foreach (HediffCompProperties comp in hediffDef.comps)
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        if (comp.compClass == typeof(HediffComp_Menstruation) || comp.compClass.IsSubclassOf(typeof(HediffComp_Menstruation)))
 | 
				
			||||||
 | 
					                        {
 | 
				
			||||||
 | 
					                            allvaginas.Add(hediffDef);
 | 
				
			||||||
 | 
					                            break;
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                
 | 
				
			||||||
                return allvaginas;
 | 
					                return allvaginas;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue