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
*.odx.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>
<identifier>RJW patch - Harvest Organs Post Mortem</identifier>
<version>4943.0.1.3</version>
<version>4943.0.1.4</version>
</Manifest>

Binary file not shown.

View file

@ -1,10 +1,14 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31911.196
# Visual Studio Version 17
VisualStudioVersion = 17.1.32113.165
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}"
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
GlobalSection(SolutionConfigurationPlatforms) = preSolution
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}.Release|Any CPU.ActiveCfg = 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
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

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

View file

@ -11,7 +11,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RJW_patch_Autopsy")]
[assembly: AssemblyCopyright("©2021 Stardust3D")]
[assembly: AssemblyCopyright("©2022 Stardust3D")]
[assembly: AssemblyTrademark("")]
[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
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4943.0.1.3")]
[assembly: AssemblyFileVersion("4943.0.1.3")]
[assembly: AssemblyVersion("4943.0.1.4")]
[assembly: AssemblyFileVersion("4943.0.1.4")]

View file

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

Binary file not shown.

View file

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