mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Change GetHARComp to return a ThingComp, since using a type that might not be loaded will cause an error upon trying to open the dev actions
This commit is contained in:
		
							parent
							
								
									08e3a2fd51
								
							
						
					
					
						commit
						973e83c8f1
					
				
					 2 changed files with 6 additions and 5 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -14,15 +14,16 @@ namespace RJW_Menstruation
 | 
				
			||||||
            return pawn?.def is ThingDef_AlienRace;
 | 
					            return pawn?.def is ThingDef_AlienRace;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static AlienPartGenerator.AlienComp GetHARComp(this Pawn pawn)
 | 
					        // Can't have it be a AlienPartGenerator.AlienComp due to the way the dev actions look for functions
 | 
				
			||||||
 | 
					        public static ThingComp GetHARComp(this Pawn pawn)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            return pawn?.TryGetComp<AlienPartGenerator.AlienComp>();
 | 
					            return pawn?.TryGetComp<AlienPartGenerator.AlienComp>();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public static void CopyHARProperties(Pawn baby, Pawn original)
 | 
					        public static void CopyHARProperties(Pawn baby, Pawn original)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            AlienPartGenerator.AlienComp babyHARComp = baby.GetHARComp();
 | 
					            AlienPartGenerator.AlienComp babyHARComp = (AlienPartGenerator.AlienComp)baby.GetHARComp();
 | 
				
			||||||
            AlienPartGenerator.AlienComp originalHARComp = original.GetHARComp();
 | 
					            AlienPartGenerator.AlienComp originalHARComp = (AlienPartGenerator.AlienComp)original.GetHARComp();
 | 
				
			||||||
            if (babyHARComp == null || originalHARComp == null) return;
 | 
					            if (babyHARComp == null || originalHARComp == null) return;
 | 
				
			||||||
            babyHARComp.crownType = originalHARComp.crownType;
 | 
					            babyHARComp.crownType = originalHARComp.crownType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,8 +38,8 @@ namespace RJW_Menstruation
 | 
				
			||||||
        // HAR doesn't populate variants until the graphics are called for, so this has to happen late
 | 
					        // HAR doesn't populate variants until the graphics are called for, so this has to happen late
 | 
				
			||||||
        public static void CopyHARPropertiesPostBirth(Pawn baby, Pawn original)
 | 
					        public static void CopyHARPropertiesPostBirth(Pawn baby, Pawn original)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            AlienPartGenerator.AlienComp babyHARComp = baby.GetHARComp();
 | 
					            AlienPartGenerator.AlienComp babyHARComp = (AlienPartGenerator.AlienComp)baby.GetHARComp();
 | 
				
			||||||
            AlienPartGenerator.AlienComp originalHARComp = original.GetHARComp();
 | 
					            AlienPartGenerator.AlienComp originalHARComp = (AlienPartGenerator.AlienComp)original.GetHARComp();
 | 
				
			||||||
            if (babyHARComp == null || originalHARComp == null) return;
 | 
					            if (babyHARComp == null || originalHARComp == null) return;
 | 
				
			||||||
            if (originalHARComp.addonVariants != null)  // Testing has shown that the addons are valid by this point, but it's better to be safe
 | 
					            if (originalHARComp.addonVariants != null)  // Testing has shown that the addons are valid by this point, but it's better to be safe
 | 
				
			||||||
                babyHARComp.addonVariants = new List<int>(originalHARComp.addonVariants);
 | 
					                babyHARComp.addonVariants = new List<int>(originalHARComp.addonVariants);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue