diff --git a/1.3/Assemblies/RJW_patch_Autopsy.dll b/1.3/Assemblies/RJW_patch_Autopsy.dll index 2405fa2..092b8e0 100644 Binary files a/1.3/Assemblies/RJW_patch_Autopsy.dll and b/1.3/Assemblies/RJW_patch_Autopsy.dll differ diff --git a/Assemblies/RJW_patch_Autopsy.dll b/Assemblies/RJW_patch_Autopsy.dll index 2405fa2..092b8e0 100644 Binary files a/Assemblies/RJW_patch_Autopsy.dll and b/Assemblies/RJW_patch_Autopsy.dll differ diff --git a/Source/RJW_patch_Autopsy/Autopsy RJW Patch.csproj b/Source/RJW_patch_Autopsy/Autopsy RJW Patch.csproj index df29d59..dc5ab98 100644 --- a/Source/RJW_patch_Autopsy/Autopsy RJW Patch.csproj +++ b/Source/RJW_patch_Autopsy/Autopsy RJW Patch.csproj @@ -41,6 +41,12 @@ true + + true + + + false + ..\packages\Lib.Harmony.2.1.1\lib\net472\0Harmony.dll @@ -86,6 +92,7 @@ + \ No newline at end of file diff --git a/Source/RJW_patch_Autopsy/Mod.cs b/Source/RJW_patch_Autopsy/Mod.cs index 98f6bfe..9c0543b 100644 --- a/Source/RJW_patch_Autopsy/Mod.cs +++ b/Source/RJW_patch_Autopsy/Mod.cs @@ -5,6 +5,5 @@ namespace RJW_patch_Autopsy public class Mod : ModBase { public override string ModIdentifier => "Stardust3D.RJW.patch.Autopsy"; - } } \ No newline at end of file diff --git a/Source/RJW_patch_Autopsy/Patches/Harmony.cs b/Source/RJW_patch_Autopsy/Patches/Harmony.cs index 4af076b..2abc5c6 100644 --- a/Source/RJW_patch_Autopsy/Patches/Harmony.cs +++ b/Source/RJW_patch_Autopsy/Patches/Harmony.cs @@ -13,4 +13,4 @@ namespace RJW_patch_Autopsy har.PatchAll(Assembly.GetExecutingAssembly()); } } -} +} \ No newline at end of file diff --git a/Source/RJW_patch_Autopsy/Patches/NewMedicalRecipesUtilityPatch.cs b/Source/RJW_patch_Autopsy/Patches/NewMedicalRecipesUtilityPatch.cs index 633149c..083c620 100644 --- a/Source/RJW_patch_Autopsy/Patches/NewMedicalRecipesUtilityPatch.cs +++ b/Source/RJW_patch_Autopsy/Patches/NewMedicalRecipesUtilityPatch.cs @@ -12,45 +12,56 @@ namespace RJW_patch_Autopsy public static class NewMedicalRecipesUtilityPatch { [HarmonyPrefix] - public static bool AddRjwParts(RecipeInfo recipeInfo, Corpse corpse, float skillChance, ref IEnumerable __result) + public static bool AddRjwParts(RecipeInfo recipeInfo, Corpse corpse, float skillChance, + ref IEnumerable __result) { //Collect vanilla parts - BodyPartRecord core = corpse.InnerPawn.RaceProps.body.corePart; - List queue = new List { core }; - HediffSet hediffSet = corpse.InnerPawn.health.hediffSet; - List results = new List(); - List damagedParts = new List(); + var core = corpse.InnerPawn.RaceProps.body.corePart; + var queue = new List {core}; + var hediffSet = corpse.InnerPawn.health.hediffSet; + var results = new List(); + var damagedParts = new List(); while (queue.Count > 0) { - BodyPartRecord part = queue.First(); + var part = queue.First(); queue.Remove(part); //Drop parts and bionics that are higher on the body tree. - if (NewMedicalRecipesUtility.TryGetParts(corpse, recipeInfo, part, skillChance, ref results, ref damagedParts) && core != part) + if (NewMedicalRecipesUtility.TryGetParts(corpse, recipeInfo, part, skillChance, ref results, + ref damagedParts) && core != part) continue; queue.AddRange(part.parts.Where(x => !hediffSet.PartIsMissing(x))); } - foreach (BodyPartRecord part in damagedParts) NewMedicalRecipesUtility.DamageHarvested(corpse.InnerPawn, part); + foreach (var part in damagedParts) + NewMedicalRecipesUtility.DamageHarvested(corpse.InnerPawn, part); //Collect rjw rediffs - List rjwNaturalDiffs = (from x in corpse.InnerPawn.health.hediffSet.hediffs - where x is Hediff_PartBaseNatural - select x).ToList(); - List rjwArtificialDiffs = (from x in corpse.InnerPawn.health.hediffSet.hediffs - where x is Hediff_PartBaseArtifical - select x).ToList(); + var rjwNaturalDiffs = (from x in corpse.InnerPawn.health.hediffSet.hediffs + where x is Hediff_PartBaseNatural + select x).ToList(); + var rjwArtificialDiffs = (from x in corpse.InnerPawn.health.hediffSet.hediffs + where x is Hediff_PartBaseArtifical + select x).ToList(); //Log.Message(String.Format("Collected {0} natural and {1} artifical hediffs", rjwNaturalDiffs.Count(), rjwArtificialDiffs.Count())); //Collect parts from hediffs rjw's surgery methods - List rjwNaturalThings = rjwNaturalDiffs.Select(d => SexPartAdder.recipePartRemover(d)).ToList(); - List rjwArtificialThings = rjwArtificialDiffs.Select(d => SexPartAdder.recipePartRemover(d)).ToList(); + var rjwNaturalThings = rjwNaturalDiffs.Select(SexPartAdder.recipePartRemover).ToList(); + var rjwArtificialThings = + rjwArtificialDiffs.Select(SexPartAdder.recipePartRemover).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(String.Format("Collected {0} things from {1} natural and {2} things from {3} artifical hediffs", + //rjwArtificialThings.Count(), rjwNaturalDiffs.Count(), rjwArtificialThings.Count(), rjwArtificialDiffs.Count())); //Simulate success chance scaled with skill etc. - rjwNaturalThings.ToList().ForEach(t => { if (Rand.Chance(Math.Min(skillChance, recipeInfo.NaturalChance))) results.Add(t); }); - rjwArtificialThings.ToList().ForEach(t => { if (Rand.Chance(Math.Min(skillChance, recipeInfo.BionicChance))) results.Add(t); }); + rjwNaturalThings.ToList().ForEach(t => + { + if (Rand.Chance(Math.Min(skillChance, recipeInfo.NaturalChance))) results.Add(t); + }); + rjwArtificialThings.ToList().ForEach(t => + { + if (Rand.Chance(Math.Min(skillChance, recipeInfo.BionicChance))) results.Add(t); + }); //Remove all parts that were tried to harves from the corpse rjwNaturalDiffs.ToList().ForEach(d => corpse.InnerPawn.health.RemoveHediff(d)); @@ -58,7 +69,7 @@ namespace RJW_patch_Autopsy if (results.Count() > recipeInfo.PartNumber) { - Random random = new Random(); + var random = new Random(); __result = results.OrderBy(i => random.Next()).Take(recipeInfo.PartNumber); } else @@ -69,4 +80,4 @@ namespace RJW_patch_Autopsy return false; } } -} +} \ No newline at end of file diff --git a/Source/RJW_patch_Autopsy/Properties/AssemblyInfo.cs b/Source/RJW_patch_Autopsy/Properties/AssemblyInfo.cs index 17077c1..1cba23f 100644 --- a/Source/RJW_patch_Autopsy/Properties/AssemblyInfo.cs +++ b/Source/RJW_patch_Autopsy/Properties/AssemblyInfo.cs @@ -31,5 +31,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("493.0.1.1")] -[assembly: AssemblyFileVersion("493.0.1.1")] \ No newline at end of file +[assembly: AssemblyVersion("493.0.1.2")] +[assembly: AssemblyFileVersion("493.0.1.2")] \ No newline at end of file