This commit is contained in:
Stardust3D 2022-01-23 22:06:32 +01:00
parent 7e1cb42210
commit 4300036667
10 changed files with 131 additions and 109 deletions

6
.gitignore vendored
View file

@ -301,9 +301,3 @@ __pycache__/
*.btm.cs *.btm.cs
*.odx.cs *.odx.cs
*.xsd.cs *.xsd.cs
Assemblies/0Harmony.dll
Assemblies/0Harmony.xml
Assemblies/0MultiplayerAPI.dll
Assemblies/Autopsy.dll
Assemblies/RJW.dll
Assemblies/RJW_patch_Autopsy.xml

Binary file not shown.

View file

@ -2,5 +2,5 @@
<Manifest> <Manifest>
<identifier>RJW patch - Harvest Organs Post Mortem</identifier> <identifier>RJW patch - Harvest Organs Post Mortem</identifier>
<version>4943.0.1.3</version> <version>4943.0.1.4</version>
</Manifest> </Manifest>

Binary file not shown.

View file

@ -1,10 +1,14 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.31911.196 VisualStudioVersion = 17.1.32113.165
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RJW_patch_Autopsy", "RJW_patch_Autopsy\RJW_patch_Autopsy.csproj", "{F17C6B3F-BA9D-4133-A201-1265A64BCB71}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RJW_patch_Autopsy", "RJW_patch_Autopsy\RJW_patch_Autopsy.csproj", "{F17C6B3F-BA9D-4133-A201-1265A64BCB71}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RimJobWorld.Main", "..\..\rjw-base\1.3\Source\RimJobWorld.Main.csproj", "{22F82FFF-8BD4-4CEE-9F22-C7DA71281E72}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Autopsy", "..\..\RimwoldAutopsy\Source\Autopsy\Autopsy.csproj", "{CDD2AF9A-353D-4313-A9EF-517BF4547D3A}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -15,6 +19,14 @@ Global
{F17C6B3F-BA9D-4133-A201-1265A64BCB71}.Debug|Any CPU.Build.0 = Debug|Any CPU {F17C6B3F-BA9D-4133-A201-1265A64BCB71}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F17C6B3F-BA9D-4133-A201-1265A64BCB71}.Release|Any CPU.ActiveCfg = Release|Any CPU {F17C6B3F-BA9D-4133-A201-1265A64BCB71}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F17C6B3F-BA9D-4133-A201-1265A64BCB71}.Release|Any CPU.Build.0 = Release|Any CPU {F17C6B3F-BA9D-4133-A201-1265A64BCB71}.Release|Any CPU.Build.0 = Release|Any CPU
{22F82FFF-8BD4-4CEE-9F22-C7DA71281E72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{22F82FFF-8BD4-4CEE-9F22-C7DA71281E72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{22F82FFF-8BD4-4CEE-9F22-C7DA71281E72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{22F82FFF-8BD4-4CEE-9F22-C7DA71281E72}.Release|Any CPU.Build.0 = Release|Any CPU
{CDD2AF9A-353D-4313-A9EF-517BF4547D3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CDD2AF9A-353D-4313-A9EF-517BF4547D3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CDD2AF9A-353D-4313-A9EF-517BF4547D3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CDD2AF9A-353D-4313-A9EF-517BF4547D3A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -8,12 +8,22 @@ using HarmonyLib;
namespace RJW_patch_Autopsy namespace RJW_patch_Autopsy
{ {
[HarmonyPatch(typeof(NewMedicalRecipesUtility), "TraverseBody")] [HarmonyPatch(typeof(NewMedicalRecipesUtility), nameof(NewMedicalRecipesUtility.TraverseBody))]
public static class NewMedicalRecipesUtilityPatch public static class NewMedicalRecipesUtilityPatch
{ {
private const bool DO_LOG = false;
private static void log(String message)
{
if (DO_LOG)
{
Log.Message(message);
}
}
[HarmonyPostfix] [HarmonyPostfix]
public static void AddRjwParts(RecipeInfo recipeInfo, Corpse corpse, float skillChance, public static IEnumerable<Thing> AddRjwParts(IEnumerable<Thing> __result, RecipeInfo recipeInfo, Corpse corpse,
ref IEnumerable<Thing> __result) float skillChance)
{ {
/*//Collect vanilla parts /*//Collect vanilla parts
var core = corpse.InnerPawn.RaceProps.body.corePart; var core = corpse.InnerPawn.RaceProps.body.corePart;
@ -36,7 +46,7 @@ namespace RJW_patch_Autopsy
NewMedicalRecipesUtility.DamageHarvested(corpse.InnerPawn, part); NewMedicalRecipesUtility.DamageHarvested(corpse.InnerPawn, part);
*/ */
var results = __result.ToList(); var results = __result.ToList();
Log.Message($"Collected {results.Count} vanilla parts"); log($"Collected {results.Count} vanilla parts");
//Collect rjw rediffs //Collect rjw rediffs
var rjwNaturalDiffs = (from x in corpse.InnerPawn.health.hediffSet.hediffs var rjwNaturalDiffs = (from x in corpse.InnerPawn.health.hediffSet.hediffs
@ -46,7 +56,7 @@ namespace RJW_patch_Autopsy
where x is Hediff_PartBaseArtifical where x is Hediff_PartBaseArtifical
select x).ToList(); select x).ToList();
Log.Message($"Collected {rjwNaturalDiffs.Count} natural and {rjwArtificialDiffs.Count} artificial hediffs"); log($"Collected {rjwNaturalDiffs.Count} natural and {rjwArtificialDiffs.Count} artificial hediffs");
//Collect parts from hediffs rjw's surgery methods //Collect parts from hediffs rjw's surgery methods
var rjwNaturalThings = rjwNaturalDiffs.Select(hediff => var rjwNaturalThings = rjwNaturalDiffs.Select(hediff =>
@ -62,7 +72,7 @@ namespace RJW_patch_Autopsy
return tmp; return tmp;
}).ToList(); }).ToList();
Log.Message( log(
$"Collected {rjwNaturalThings.Count} things from {rjwNaturalDiffs.Count} natural and {rjwArtificialThings.Count} things from {rjwArtificialDiffs.Count} artificial hediffs"); $"Collected {rjwNaturalThings.Count} things from {rjwNaturalDiffs.Count} natural and {rjwArtificialThings.Count} things from {rjwArtificialDiffs.Count} artificial hediffs");
//Simulate success chance scaled with skill etc. //Simulate success chance scaled with skill etc.
@ -82,13 +92,13 @@ namespace RJW_patch_Autopsy
if (results.Count > recipeInfo.PartNumber) if (results.Count > recipeInfo.PartNumber)
{ {
var random = new Random(); var random = new Random();
__result = results.OrderBy(i => random.Next()).Take(recipeInfo.PartNumber); results = results.OrderBy(i => random.Next()).Take(recipeInfo.PartNumber).ToList();
}
else
{
__result = results;
} }
foreach (var result in results)
{
yield return result;
}
// return false; // return false;
} }
} }

View file

@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RJW_patch_Autopsy")] [assembly: AssemblyProduct("RJW_patch_Autopsy")]
[assembly: AssemblyCopyright("©2021 Stardust3D")] [assembly: AssemblyCopyright("©2022 Stardust3D")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4943.0.1.3")] [assembly: AssemblyVersion("4943.0.1.4")]
[assembly: AssemblyFileVersion("4943.0.1.3")] [assembly: AssemblyFileVersion("4943.0.1.4")]

View file

@ -1,88 +1,94 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{F17C6B3F-BA9D-4133-A201-1265A64BCB71}</ProjectGuid> <ProjectGuid>{F17C6B3F-BA9D-4133-A201-1265A64BCB71}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>RJW_patch_Autopsy</RootNamespace> <RootNamespace>RJW_patch_Autopsy</RootNamespace>
<AssemblyName>RJW_patch_Autopsy</AssemblyName> <AssemblyName>RJW_patch_Autopsy</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion> <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>
<TargetFrameworkProfile> <TargetFrameworkProfile>
</TargetFrameworkProfile> </TargetFrameworkProfile>
</PropertyGroup> <AssemblyOriginatorKeyFile>RJW_patch_Autopsy.snk</AssemblyOriginatorKeyFile>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> </PropertyGroup>
<DebugSymbols>true</DebugSymbols> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>portable</DebugType> <DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize> <DebugType>portable</DebugType>
<OutputPath>..\..\Assemblies\</OutputPath> <Optimize>false</Optimize>
<DefineConstants>DEBUG;TRACE</DefineConstants> <OutputPath>..\..\Assemblies\</OutputPath>
<ErrorReport>prompt</ErrorReport> <DefineConstants>DEBUG;TRACE</DefineConstants>
<WarningLevel>4</WarningLevel> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit> <WarningLevel>4</WarningLevel>
<DocumentationFile> <Prefer32Bit>false</Prefer32Bit>
</DocumentationFile> <DocumentationFile>
</PropertyGroup> </DocumentationFile>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> </PropertyGroup>
<DebugType>portable</DebugType> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize> <DebugType>portable</DebugType>
<OutputPath>..\..\Assemblies\</OutputPath> <Optimize>true</Optimize>
<DefineConstants> <OutputPath>..\..\Assemblies\</OutputPath>
</DefineConstants> <DefineConstants>
<ErrorReport>prompt</ErrorReport> </DefineConstants>
<WarningLevel>4</WarningLevel> <ErrorReport>prompt</ErrorReport>
<Prefer32Bit>false</Prefer32Bit> <WarningLevel>4</WarningLevel>
<DocumentationFile>..\..\Assemblies\RJW_patch_Autopsy.xml</DocumentationFile> <Prefer32Bit>false</Prefer32Bit>
<DebugSymbols>true</DebugSymbols> <DocumentationFile>..\..\Assemblies\RJW_patch_Autopsy.xml</DocumentationFile>
</PropertyGroup> <DebugSymbols>true</DebugSymbols>
<PropertyGroup> </PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <PropertyGroup>
</PropertyGroup> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<PropertyGroup> </PropertyGroup>
<SignAssembly>true</SignAssembly> <PropertyGroup>
</PropertyGroup> <SignAssembly>true</SignAssembly>
<PropertyGroup> </PropertyGroup>
<DelaySign>false</DelaySign> <PropertyGroup>
</PropertyGroup> <DelaySign>false</DelaySign>
<ItemGroup> </PropertyGroup>
<Reference Include="0Harmony, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL"> <ItemGroup>
<HintPath>..\packages\Lib.Harmony.2.2.0\lib\net48\0Harmony.dll</HintPath> <Reference Include="0Harmony, Version=2.2.0.0, Culture=neutral, processorArchitecture=MSIL">
</Reference> <HintPath>..\packages\Lib.Harmony.2.2.0\lib\net48\0Harmony.dll</HintPath>
<Reference Include="Assembly-CSharp"> </Reference>
<HintPath>..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath> <Reference Include="Assembly-CSharp">
<Private>False</Private> <HintPath>..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference> <Private>False</Private>
<Reference Include="Autopsy"> </Reference>
<HintPath>..\..\..\RimwoldAutopsy\1.3\Assemblies\Autopsy.dll</HintPath> <Reference Include="HugsLib">
</Reference> <HintPath>..\..\..\..\..\..\workshop\content\294100\818773962\Assemblies\HugsLib.dll</HintPath>
<Reference Include="HugsLib"> <Private>False</Private>
<HintPath>..\..\..\..\..\..\workshop\content\294100\818773962\Assemblies\HugsLib.dll</HintPath> </Reference>
<Private>False</Private> <Reference Include="System.Core" />
</Reference> </ItemGroup>
<Reference Include="RJW"> <ItemGroup>
<HintPath>..\..\..\rjw-base\1.3\Assemblies\RJW.dll</HintPath> <Compile Include="Patches\Harmony.cs" />
</Reference> <Compile Include="Patches\NewMedicalRecipesUtilityPatch.cs" />
<Reference Include="System.Core" /> <Compile Include="Mod.cs" />
</ItemGroup> <Compile Include="Properties\AssemblyInfo.cs" />
<ItemGroup> </ItemGroup>
<Compile Include="Patches\Harmony.cs" /> <ItemGroup>
<Compile Include="Patches\NewMedicalRecipesUtilityPatch.cs" /> <Content Include="..\..\About\About.xml">
<Compile Include="Mod.cs" /> <Link>About\About.xml</Link>
<Compile Include="Properties\AssemblyInfo.cs" /> </Content>
</ItemGroup> <Content Include="..\..\About\Manifest.xml">
<ItemGroup> <Link>About\Manifest.xml</Link>
<Content Include="..\..\About\About.xml"> </Content>
<Link>About\About.xml</Link> </ItemGroup>
</Content> <ItemGroup>
<Content Include="..\..\About\Manifest.xml"> <None Include="packages.config" />
<Link>About\Manifest.xml</Link> <None Include="RJW_patch_Autopsy.snk" />
</Content> </ItemGroup>
</ItemGroup> <ItemGroup>
<ItemGroup> <ProjectReference Include="..\..\..\RimwoldAutopsy\Source\Autopsy\Autopsy.csproj">
<None Include="packages.config" /> <Project>{f17c6b3f-ba9d-4133-a201-1265a64bcb71}</Project>
</ItemGroup> <Name>Autopsy</Name>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </ProjectReference>
<ProjectReference Include="..\..\..\rjw-base\1.3\Source\RimJobWorld.Main.csproj">
<Project>{22f82fff-8bd4-4cee-9f22-c7da71281e72}</Project>
<Name>RimJobWorld.Main</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

Binary file not shown.

View file

@ -11,7 +11,7 @@ plugins {
//id("com.ullink.nunit") version "1.12" //id("com.ullink.nunit") version "1.12"
} }
version = "4943.0.1.3" version = "4943.0.1.4"
val friendlyName = "rjw-patch-autopsy" val friendlyName = "rjw-patch-autopsy"
tasks.register<com.ullink.Msbuild>("buildC#") { tasks.register<com.ullink.Msbuild>("buildC#") {