diff --git a/1.3/Assemblies/RJW_patch_Autopsy.dll b/1.3/Assemblies/RJW_patch_Autopsy.dll
index bfab639..f12ecf3 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 bfab639..f12ecf3 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 8121149..df29d59 100644
--- a/Source/RJW_patch_Autopsy/Autopsy RJW Patch.csproj
+++ b/Source/RJW_patch_Autopsy/Autopsy RJW Patch.csproj
@@ -49,9 +49,8 @@
..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll
False
-
- False
- ..\..\..\__LocalCopy_Harvest Organs Post Mortem_-11-12\1.3\Assemblies\Autopsy.dll
+
+ ..\..\..\RimwoldAutopsy\1.3\Assemblies\Autopsy.dll
..\..\..\..\..\..\workshop\content\294100\818773962\Assemblies\HugsLib.dll
diff --git a/Source/RJW_patch_Autopsy/Mod.cs b/Source/RJW_patch_Autopsy/Mod.cs
index 24be257..98f6bfe 100644
--- a/Source/RJW_patch_Autopsy/Mod.cs
+++ b/Source/RJW_patch_Autopsy/Mod.cs
@@ -4,7 +4,7 @@ namespace RJW_patch_Autopsy
{
public class Mod : ModBase
{
- public override string ModIdentifier => "RJW Patch - Autopsy";
+ public override string ModIdentifier => "Stardust3D.RJW.patch.Autopsy";
}
}
\ 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 97f2e9c..633149c 100644
--- a/Source/RJW_patch_Autopsy/Patches/NewMedicalRecipesUtilityPatch.cs
+++ b/Source/RJW_patch_Autopsy/Patches/NewMedicalRecipesUtilityPatch.cs
@@ -11,26 +11,62 @@ namespace RJW_patch_Autopsy
[HarmonyPatch(typeof(NewMedicalRecipesUtility), "TraverseBody")]
public static class NewMedicalRecipesUtilityPatch
{
- [HarmonyPostfix]
- public static void AddRjwParts(RecipeInfo recipeInfo, Corpse corpse, float skillChance, ref IEnumerable __result)
+ [HarmonyPrefix]
+ public static bool AddRjwParts(RecipeInfo recipeInfo, Corpse corpse, float skillChance, ref IEnumerable __result)
{
- var previousResult = __result.ToList();
+ //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();
+ while (queue.Count > 0)
+ {
+ BodyPartRecord 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)
+ continue;
+ queue.AddRange(part.parts.Where(x => !hediffSet.PartIsMissing(x)));
+ }
+
+ foreach (BodyPartRecord part in damagedParts) NewMedicalRecipesUtility.DamageHarvested(corpse.InnerPawn, part);
//Collect rjw rediffs
- IEnumerable rjwDiffs = from x in corpse.InnerPawn.health.hediffSet.hediffs
- where x is Hediff_PartBaseNatural || x is Hediff_PartBaseArtifical
- select x;
+ 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();
+
+ //Log.Message(String.Format("Collected {0} natural and {1} artifical hediffs", rjwNaturalDiffs.Count(), rjwArtificialDiffs.Count()));
//Collect parts from hediffs rjw's surgery methods
- IEnumerable rjwThings = rjwDiffs.Select(d => SexPartAdder.recipePartRemover(d));
+ List rjwNaturalThings = rjwNaturalDiffs.Select(d => SexPartAdder.recipePartRemover(d)).ToList();
+ List rjwArtificialThings = rjwArtificialDiffs.Select(d => SexPartAdder.recipePartRemover(d)).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()));
//Simulate success chance scaled with skill etc.
- rjwThings.ToList().ForEach(t => { if (Rand.Chance(Math.Min(skillChance, recipeInfo.NaturalChance))) previousResult.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
- rjwDiffs.ToList().ForEach(d => corpse.InnerPawn.health.RemoveHediff(d));
+ rjwNaturalDiffs.ToList().ForEach(d => corpse.InnerPawn.health.RemoveHediff(d));
+ rjwArtificialDiffs.ToList().ForEach(d => corpse.InnerPawn.health.RemoveHediff(d));
- __result = previousResult;
+ if (results.Count() > recipeInfo.PartNumber)
+ {
+ Random random = new Random();
+ __result = results.OrderBy(i => random.Next()).Take(recipeInfo.PartNumber);
+ }
+ else
+ {
+ __result = results;
+ }
+
+ return false;
}
}
}
diff --git a/Source/RJW_patch_Autopsy/Properties/AssemblyInfo.cs b/Source/RJW_patch_Autopsy/Properties/AssemblyInfo.cs
index 3856236..8117f2a 100644
--- a/Source/RJW_patch_Autopsy/Properties/AssemblyInfo.cs
+++ b/Source/RJW_patch_Autopsy/Properties/AssemblyInfo.cs
@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RJW_patch_Autopsy")]
-[assembly: AssemblyCopyright("Copyright © 2021")]
+[assembly: AssemblyCopyright("©2021 Stardust3D")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -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("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
+[assembly: AssemblyVersion("1.0.1.0")]
+[assembly: AssemblyFileVersion("1.0.1.0")]
\ No newline at end of file