mirror of
				https://gitgud.io/Stardust3D/rjw-patch-autopsy.git
				synced 2024-08-15 00:43:41 +00:00 
			
		
		
		
	converted into postfix
This commit is contained in:
		
							parent
							
								
									34522848ea
								
							
						
					
					
						commit
						7e1cb42210
					
				
					 1 changed files with 22 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -11,11 +11,11 @@ namespace RJW_patch_Autopsy
 | 
			
		|||
    [HarmonyPatch(typeof(NewMedicalRecipesUtility), "TraverseBody")]
 | 
			
		||||
    public static class NewMedicalRecipesUtilityPatch
 | 
			
		||||
    {
 | 
			
		||||
        [HarmonyPrefix]
 | 
			
		||||
        public static bool AddRjwParts(RecipeInfo recipeInfo, Corpse corpse, float skillChance,
 | 
			
		||||
        [HarmonyPostfix]
 | 
			
		||||
        public static void AddRjwParts(RecipeInfo recipeInfo, Corpse corpse, float skillChance,
 | 
			
		||||
            ref IEnumerable<Thing> __result)
 | 
			
		||||
        {
 | 
			
		||||
            //Collect vanilla parts
 | 
			
		||||
            /*//Collect vanilla parts
 | 
			
		||||
            var core = corpse.InnerPawn.RaceProps.body.corePart;
 | 
			
		||||
            var queue = new List<BodyPartRecord> {core};
 | 
			
		||||
            var hediffSet = corpse.InnerPawn.health.hediffSet;
 | 
			
		||||
| 
						 | 
				
			
			@ -34,6 +34,9 @@ namespace RJW_patch_Autopsy
 | 
			
		|||
 | 
			
		||||
            foreach (var part in damagedParts)
 | 
			
		||||
                NewMedicalRecipesUtility.DamageHarvested(corpse.InnerPawn, part);
 | 
			
		||||
            */
 | 
			
		||||
            var results = __result.ToList();
 | 
			
		||||
            Log.Message($"Collected {results.Count} vanilla parts");
 | 
			
		||||
 | 
			
		||||
            //Collect rjw rediffs
 | 
			
		||||
            var rjwNaturalDiffs = (from x in corpse.InnerPawn.health.hediffSet.hediffs
 | 
			
		||||
| 
						 | 
				
			
			@ -43,15 +46,24 @@ namespace RJW_patch_Autopsy
 | 
			
		|||
                where x is Hediff_PartBaseArtifical
 | 
			
		||||
                select x).ToList();
 | 
			
		||||
 | 
			
		||||
            //Log.Message(String.Format("Collected {0} natural and {1} artifical hediffs", rjwNaturalDiffs.Count(), rjwArtificialDiffs.Count()));
 | 
			
		||||
            Log.Message($"Collected {rjwNaturalDiffs.Count} natural and {rjwArtificialDiffs.Count} artificial hediffs");
 | 
			
		||||
 | 
			
		||||
            //Collect parts from hediffs rjw's surgery methods
 | 
			
		||||
            var rjwNaturalThings = rjwNaturalDiffs.Select(SexPartAdder.recipePartRemover).ToList();
 | 
			
		||||
            var rjwArtificialThings =
 | 
			
		||||
                rjwArtificialDiffs.Select(SexPartAdder.recipePartRemover).ToList();
 | 
			
		||||
            var rjwNaturalThings = rjwNaturalDiffs.Select(hediff =>
 | 
			
		||||
            {
 | 
			
		||||
                var tmp = SexPartAdder.recipePartRemover(hediff);
 | 
			
		||||
                Log.Message($"obtained ${tmp} from ${hediff} via rjw");
 | 
			
		||||
                return tmp;
 | 
			
		||||
            }).ToList();
 | 
			
		||||
            var rjwArtificialThings = rjwArtificialDiffs.Select(hediff =>
 | 
			
		||||
            {
 | 
			
		||||
                var tmp = SexPartAdder.recipePartRemover(hediff);
 | 
			
		||||
                Log.Message($"obtained ${tmp} from ${hediff} via rjw");
 | 
			
		||||
                return tmp;
 | 
			
		||||
            }).ToList();
 | 
			
		||||
 | 
			
		||||
            //Log.Message(String.Format("Collected {0} things from {1} natural and {2} things from {3} artifical hediffs",
 | 
			
		||||
            //rjwArtificialThings.Count(), rjwNaturalDiffs.Count(), rjwArtificialThings.Count(), rjwArtificialDiffs.Count()));
 | 
			
		||||
            Log.Message(
 | 
			
		||||
                $"Collected {rjwNaturalThings.Count} things from {rjwNaturalDiffs.Count} natural and {rjwArtificialThings.Count} things from {rjwArtificialDiffs.Count} artificial hediffs");
 | 
			
		||||
 | 
			
		||||
            //Simulate success chance scaled with skill etc.
 | 
			
		||||
            rjwNaturalThings.ForEach(t =>
 | 
			
		||||
| 
						 | 
				
			
			@ -77,7 +89,7 @@ namespace RJW_patch_Autopsy
 | 
			
		|||
                __result = results;
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            return false;
 | 
			
		||||
            // return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue