mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Additional safety checks for the transpilers
This commit is contained in:
		
							parent
							
								
									c955221f64
								
							
						
					
					
						commit
						06039238d2
					
				
					 3 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
					@ -428,7 +428,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    if (i == 0)
 | 
					                    if (i == 0)
 | 
				
			||||||
                    {                    
 | 
					                    {                    
 | 
				
			||||||
                        if (baby.IsHAR())   // necessary for HAR to decide on graphical properties pre-birth
 | 
					                        if (baby.IsHAR())   // Have HAR determine the first baby's properties
 | 
				
			||||||
                            baby.Drawer.renderer.graphics.ResolveAllGraphics();
 | 
					                            baby.Drawer.renderer.graphics.ResolveAllGraphics();
 | 
				
			||||||
                        firstbaby = baby;
 | 
					                        firstbaby = baby;
 | 
				
			||||||
                        request.FixedGender = baby.gender;
 | 
					                        request.FixedGender = baby.gender;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -141,7 +141,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
        // Also called for Recipe_TerminatePregnancy.ApplyOnPawn
 | 
					        // Also called for Recipe_TerminatePregnancy.ApplyOnPawn
 | 
				
			||||||
        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
					        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (GetPregnancyHediff == null) throw new System.InvalidOperationException("GetPregnancyHediff not found");
 | 
					            if (GetPregnancyHediff == null || GetPregnancyHediff.ReturnType != typeof(Hediff)) throw new System.InvalidOperationException("GetPregnancyHediff not found");
 | 
				
			||||||
            foreach (CodeInstruction instruction in instructions)
 | 
					            foreach (CodeInstruction instruction in instructions)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (instruction.Calls(GetPregnancyHediff))
 | 
					                if (instruction.Calls(GetPregnancyHediff))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -132,7 +132,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
        private static readonly MethodInfo IsPregnant = AccessTools.Method(typeof(PawnExtensions), nameof(PawnExtensions.IsPregnant), new System.Type[] {typeof(Pawn), typeof(bool)});
 | 
					        private static readonly MethodInfo IsPregnant = AccessTools.Method(typeof(PawnExtensions), nameof(PawnExtensions.IsPregnant), new System.Type[] {typeof(Pawn), typeof(bool)});
 | 
				
			||||||
        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
					        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (IsPregnant == null) throw new System.InvalidOperationException("IsPregnant not found");
 | 
					            if (IsPregnant == null || IsPregnant.ReturnType != typeof(bool)) throw new System.InvalidOperationException("IsPregnant not found");
 | 
				
			||||||
            foreach(CodeInstruction instruction in instructions)
 | 
					            foreach(CodeInstruction instruction in instructions)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (instruction.Calls(IsPregnant))
 | 
					                if (instruction.Calls(IsPregnant))
 | 
				
			||||||
| 
						 | 
					@ -239,7 +239,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
        private static readonly FieldInfo MinimumFuckabilityToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumFuckabilityToHookup));
 | 
					        private static readonly FieldInfo MinimumFuckabilityToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumFuckabilityToHookup));
 | 
				
			||||||
        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
					        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (MinimumFuckabilityToHookup == null) throw new System.InvalidOperationException("MinimumFuckabilityToHookup not found");
 | 
					            if (MinimumFuckabilityToHookup == null || MinimumFuckabilityToHookup.FieldType != typeof(float)) throw new System.InvalidOperationException("MinimumFuckabilityToHookup not found");
 | 
				
			||||||
            bool first_fuckability = true;
 | 
					            bool first_fuckability = true;
 | 
				
			||||||
            foreach (CodeInstruction instruction in instructions)
 | 
					            foreach (CodeInstruction instruction in instructions)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					@ -275,8 +275,8 @@ namespace RJW_Menstruation
 | 
				
			||||||
        private static readonly FieldInfo MinimumRelationshipToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumRelationshipToHookup));
 | 
					        private static readonly FieldInfo MinimumRelationshipToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumRelationshipToHookup));
 | 
				
			||||||
        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
					        public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (MinimumAttractivenessToHookup == null) throw new System.InvalidOperationException("MinimumAttractivenessToHookup not found");
 | 
					            if (MinimumAttractivenessToHookup == null || MinimumAttractivenessToHookup.FieldType != typeof(float)) throw new System.InvalidOperationException("MinimumAttractivenessToHookup not found");
 | 
				
			||||||
            if (MinimumRelationshipToHookup == null) throw new System.InvalidOperationException("MinimumRelationshipToHookup not found");
 | 
					            if (MinimumRelationshipToHookup == null || MinimumRelationshipToHookup.FieldType != typeof(float)) throw new System.InvalidOperationException("MinimumRelationshipToHookup not found");
 | 
				
			||||||
            LocalBuilder pawn_index = null;
 | 
					            LocalBuilder pawn_index = null;
 | 
				
			||||||
            // Like in the last one, we switch the arguments around for the second load
 | 
					            // Like in the last one, we switch the arguments around for the second load
 | 
				
			||||||
            bool first_attractiveness = true;
 | 
					            bool first_attractiveness = true;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue