mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Handle inheritable xenotypes and hybrids
This commit is contained in:
		
							parent
							
								
									8c213c4fe6
								
							
						
					
					
						commit
						ea1c5794f9
					
				
					 4 changed files with 56 additions and 0 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| 
						 | 
				
			
			@ -439,6 +439,20 @@ namespace RJW_Menstruation
 | 
			
		|||
                        firstbaby = baby;
 | 
			
		||||
                        request.FixedGender = baby.gender;
 | 
			
		||||
                        request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
 | 
			
		||||
                        if (GeneUtility.SameHeritableXenotype(mother, father) && mother.genes.UniqueXenotype)
 | 
			
		||||
                        {
 | 
			
		||||
                            baby.genes.xenotypeName = mother.genes.xenotypeName;
 | 
			
		||||
                            baby.genes.iconDef = mother.genes.iconDef;
 | 
			
		||||
                        }
 | 
			
		||||
                        if (baby.genes != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            baby.genes.SetXenotypeDirect(BabyXenoTypeDecider(mother, father, out bool hybridBaby));
 | 
			
		||||
                            if(hybridBaby)
 | 
			
		||||
                            {
 | 
			
		||||
                                baby.genes.hybrid = true;
 | 
			
		||||
                                baby.genes.xenotypeName = "Hybrid".Translate();
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    else
 | 
			
		||||
                    {
 | 
			
		||||
| 
						 | 
				
			
			@ -451,6 +465,14 @@ namespace RJW_Menstruation
 | 
			
		|||
                            baby.story.bodyType = firstbaby.story.bodyType;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (baby.genes != null)
 | 
			
		||||
                        {
 | 
			
		||||
                            baby.genes.SetXenotypeDirect(firstbaby.genes.Xenotype);
 | 
			
		||||
                            baby.genes.xenotypeName = firstbaby.genes.xenotypeName;
 | 
			
		||||
                            baby.genes.iconDef = firstbaby.genes.iconDef;
 | 
			
		||||
                            baby.genes.hybrid = firstbaby.genes.hybrid;
 | 
			
		||||
                        }
 | 
			
		||||
 | 
			
		||||
                        if (baby.IsHAR())
 | 
			
		||||
                            HARCompatibility.CopyHARProperties(baby, firstbaby);
 | 
			
		||||
                        //if (Configurations.AnimalGeneticsActivated)
 | 
			
		||||
| 
						 | 
				
			
			@ -621,6 +643,39 @@ namespace RJW_Menstruation
 | 
			
		|||
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public XenotypeDef BabyXenoTypeDecider(Pawn mother, Pawn father, out bool hybrid)
 | 
			
		||||
        {
 | 
			
		||||
            hybrid = false;
 | 
			
		||||
            bool hybridMother = mother?.genes?.hybrid ?? false;
 | 
			
		||||
            bool hybridFather = father?.genes?.hybrid ?? false;
 | 
			
		||||
            if (hybridMother && hybridFather)
 | 
			
		||||
            {
 | 
			
		||||
                hybrid = true;
 | 
			
		||||
                return null;
 | 
			
		||||
            }
 | 
			
		||||
            XenotypeDef motherInheritableXenotype = mother?.genes?.Xenotype;
 | 
			
		||||
            XenotypeDef fatherInheritableXenotype = father?.genes?.Xenotype;
 | 
			
		||||
            if (!motherInheritableXenotype.inheritable) motherInheritableXenotype = null;
 | 
			
		||||
            if (!fatherInheritableXenotype.inheritable) fatherInheritableXenotype = null;
 | 
			
		||||
 | 
			
		||||
            // If they're the same (or both null)
 | 
			
		||||
            if (motherInheritableXenotype == fatherInheritableXenotype)
 | 
			
		||||
            {
 | 
			
		||||
                // Both null, but one's a hybrid
 | 
			
		||||
                if (motherInheritableXenotype == null && (hybridMother || hybridFather))
 | 
			
		||||
                    hybrid = true;
 | 
			
		||||
                
 | 
			
		||||
                return motherInheritableXenotype;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // If one is null and the other isn't
 | 
			
		||||
            if ((motherInheritableXenotype == null) != (fatherInheritableXenotype == null)) return motherInheritableXenotype ?? fatherInheritableXenotype;
 | 
			
		||||
 | 
			
		||||
            // So two different inheritable ones
 | 
			
		||||
            hybrid = true;
 | 
			
		||||
            return null;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public PawnKindDef GetHybrid(Pawn first, Pawn second)
 | 
			
		||||
        {
 | 
			
		||||
            PawnKindDef res = null;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,5 +1,6 @@
 | 
			
		|||
Version 1.0.8.1
 | 
			
		||||
 - Added the option for humans to start Biotech pregnancies if the DLC is enabled. If set, non-humans will use the old multiple pregnancy instead.
 | 
			
		||||
 - Babies conceived through the multiple pregnancy option will now properly inherit xenotypes.
 | 
			
		||||
 - Properly track biotech pregnancy through labor.
 | 
			
		||||
 - A biotech pregnancy will pause before going into labor if another womb already is in labor.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue