mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Don't allow adding genes to pawns without wombs
This commit is contained in:
		
							parent
							
								
									9f20f78aab
								
							
						
					
					
						commit
						aba80efe58
					
				
					 4 changed files with 24 additions and 0 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -192,6 +192,20 @@ namespace RJW_Menstruation
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    [HarmonyPatch(typeof(Pawn_GeneTracker), "AddGene", new Type[] {typeof(Gene), typeof(bool)})]
 | 
				
			||||||
 | 
					    public class AddGene_Patch
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        public static bool Prefix(ref Gene __result, Gene gene, Pawn ___pawn)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            if(VariousDefOf.WombGenes.Contains(gene.def) && !___pawn.GetMenstruationComps().Any())
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                __result = null;
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else return true;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    [HarmonyPatch(typeof(Pawn_GeneTracker), "Notify_GenesChanged")]
 | 
					    [HarmonyPatch(typeof(Pawn_GeneTracker), "Notify_GenesChanged")]
 | 
				
			||||||
    public class Notify_GenesChanged_Patch
 | 
					    public class Notify_GenesChanged_Patch
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -53,6 +53,16 @@ namespace RJW_Menstruation
 | 
				
			||||||
        public static readonly GeneDef QuadOvulation = DefDatabase<GeneDef>.GetNamed("Menstruation_QuadOvulation");
 | 
					        public static readonly GeneDef QuadOvulation = DefDatabase<GeneDef>.GetNamed("Menstruation_QuadOvulation");
 | 
				
			||||||
        public static readonly GeneDef NoBleeding = DefDatabase<GeneDef>.GetNamed("Menstruation_NoBleeding");
 | 
					        public static readonly GeneDef NoBleeding = DefDatabase<GeneDef>.GetNamed("Menstruation_NoBleeding");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static readonly HashSet<GeneDef> WombGenes = new HashSet<GeneDef>() {
 | 
				
			||||||
 | 
					            ShortEggLifetime,
 | 
				
			||||||
 | 
					            DoubleEggLifetime,
 | 
				
			||||||
 | 
					            QuadEggLifetime,
 | 
				
			||||||
 | 
					            NeverEstrus,
 | 
				
			||||||
 | 
					            FullEstrus,
 | 
				
			||||||
 | 
					            DoubleOvulation,
 | 
				
			||||||
 | 
					            QuadOvulation,
 | 
				
			||||||
 | 
					            NoBleeding };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        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;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue