mirror of
				https://gitgud.io/c0ffeeeeeeee/rimworld-animations.git
				synced 2024-08-15 00:43:45 +00:00 
			
		
		
		
	Merge branch 'nre-partner' into 'master'
Fix NRE when jobdriver partner is null See merge request c0ffeeeeeeee/rimworld-animations!5
This commit is contained in:
		
						commit
						816e24ada1
					
				
					 1 changed files with 22 additions and 7 deletions
				
			
		| 
						 | 
					@ -504,14 +504,29 @@ namespace Rimworld_Animations {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public bool LoopNeverending()
 | 
					        public bool LoopNeverending()
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if(pawn?.jobs?.curDriver != null && 
 | 
					            return IsNeverEndingSex(pawn) || IsNeverEndingSexPartner(pawn);
 | 
				
			||||||
                (pawn.jobs.curDriver is JobDriver_Sex) && (pawn.jobs.curDriver as JobDriver_Sex).neverendingsex ||
 | 
					        }
 | 
				
			||||||
                (pawn.jobs.curDriver is JobDriver_SexBaseReciever) && (pawn.jobs.curDriver as JobDriver_Sex).Partner?.jobs?.curDriver != null && ((pawn.jobs.curDriver as JobDriver_Sex).Partner.jobs.curDriver as JobDriver_Sex).neverendingsex)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                return true;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return false;
 | 
					        public static bool IsNeverEndingSex(Pawn pawn)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            bool hasDriver = pawn?.jobs?.curDriver != null;
 | 
				
			||||||
 | 
					            if (!hasDriver)
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return (pawn.jobs.curDriver is JobDriver_Sex jds) && jds.neverendingsex;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        public static bool IsNeverEndingSexPartner(Pawn pawn)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            bool hasDriver = pawn?.jobs?.curDriver != null;
 | 
				
			||||||
 | 
					            if (!hasDriver)
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            var partner = (pawn.jobs.curDriver is JobDriver_SexBaseReciever jds) ? jds.Partner : null;
 | 
				
			||||||
 | 
					            if (partner == null)
 | 
				
			||||||
 | 
					                return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            return IsNeverEndingSex(partner);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public void ResetOnLoop()
 | 
					        public void ResetOnLoop()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue