Add compatibility code for Animal Genetics

This commit is contained in:
lutepickle 2022-09-22 08:46:00 -07:00
parent 215a94f4f5
commit 87d950eb26
6 changed files with 39 additions and 0 deletions

Binary file not shown.

View File

@ -0,0 +1,27 @@
using AnimalGenetics;
using Verse;
namespace RJW_Menstruation
{
public static class AnimalGeneticsCompatibility
{
public static void PreBirth(Pawn mother, Pawn father, Hediff pregnancy)
{
GeneticInformation motherGeneticInformation = mother?.AnimalGenetics();
GeneticInformation fatherGeneticInformation = father?.AnimalGenetics();
if (fatherGeneticInformation == null && motherGeneticInformation != null)
{
FatherGeneticInformation fatherGeneticInformationComp = pregnancy.TryGetComp<FatherGeneticInformation>();
fatherGeneticInformation = fatherGeneticInformationComp?.GeneticInformation;
}
ParentReferences.Push(new ParentReferences.Record { Mother = motherGeneticInformation, Father = fatherGeneticInformation });
}
public static void PostBirth()
{
ParentReferences.Pop();
}
}
}

View File

@ -105,6 +105,7 @@ namespace RJW_Menstruation
public static bool HARActivated = false;
public static bool AnimalGeneticsActivated = false;
public enum DetailLevel
{
@ -245,6 +246,7 @@ namespace RJW_Menstruation
{
GetSettings<Configurations>();
Configurations.HARActivated = ModLister.GetActiveModWithIdentifier("erdelf.HumanoidAlienRaces") != null;
Configurations.AnimalGeneticsActivated = ModLister.GetActiveModWithIdentifier("Mlie.AnimalGenetics") != null;
}

View File

@ -57,6 +57,8 @@ namespace RJW_Menstruation
foreach (Pawn baby in babies)
{
if (Configurations.AnimalGeneticsActivated) AnimalGeneticsCompatibility.PreBirth(pawn, Utility.GetFather(baby, pawn), this);
if (xxx.is_animal(baby))
{
BestialBirth(baby);
@ -66,6 +68,8 @@ namespace RJW_Menstruation
HumanlikeBirth(baby);
}
if (Configurations.AnimalGeneticsActivated) AnimalGeneticsCompatibility.PostBirth();
baby.ageTracker.AgeChronologicalTicks = 0;
}

View File

@ -58,6 +58,7 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Compatibility\AnimalGeneticsCompatibility.cs" />
<Compile Include="Compatibility\HARCompatibility.cs" />
<Compile Include="Configurations.cs" />
<Compile Include="Cum.cs" />
@ -95,6 +96,10 @@
<HintPath>..\..\..\..\..\..\..\..\workshop\content\294100\839005762\1.3\Assemblies\AlienRace.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="AnimalGenetics">
<HintPath>..\..\..\..\..\..\..\..\workshop\content\294100\2226725974\1.3\Assemblies\AnimalGenetics.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>False</Private>

View File

@ -4,6 +4,7 @@ Version 1.0.7.5
- Properly calculate cramp pain falloff again.
- Climacteric and menopause are now per-womb, appearing in the womb dialog instead of as hediffs. Any old hediffs should disappear upon loading the save.
- Added new property to vaginas to multiply the number of eggs available. Archotech vaginas will have quadruple the normal amount.
- Added support for Animal Genetics (Continued)
Version 1.0.7.4
- Fix errors when using other mods with bad HediffCompProperties.