Apply VE Genetics and Anomaly blood colors to bleeding

This commit is contained in:
lutepickle 2024-05-29 16:04:28 -07:00
parent 4febc97c73
commit 2dd86964d4
9 changed files with 50 additions and 15 deletions

Binary file not shown.

View file

@ -0,0 +1,20 @@
using System.Linq;
using VanillaGenesExpanded;
using Verse;
namespace RJW_Menstruation
{
public static class VECompatibility
{
public static ThingDef VEGeneBloodDef(Pawn pawn)
{
if (!ModsConfig.BiotechActive) return null;
foreach(Gene gene in pawn.genes.GenesListForReading.Where(gene => gene.Active))
{
ThingDef bloodDef = gene.def.GetModExtension<GeneExtension>()?.customBloodThingDef;
if (bloodDef != null) return bloodDef;
}
return null;
}
}
}

View file

@ -122,6 +122,7 @@ namespace RJW_Menstruation
public static bool HARActivated = false;
public static bool VEFActivated = false;
public static bool AnimalGeneticsActivated = false;
public enum DetailLevel
@ -277,6 +278,7 @@ namespace RJW_Menstruation
if (!ModsConfig.BiotechActive && Configurations.PregnancySource == Configurations.PregnancyType.Biotech)
Configurations.PregnancySource = Configurations.PregnancyType.MultiplePregnancy;
Configurations.HARActivated = ModsConfig.IsActive("erdelf.HumanoidAlienRaces");
Configurations.VEFActivated = ModsConfig.IsActive("oskarpotocki.vanillafactionsexpanded.core");
Configurations.AnimalGeneticsActivated = ModsConfig.IsActive("Mlie.AnimalGenetics");
}

View file

@ -554,8 +554,7 @@ namespace RJW_Menstruation
{
try
{
Color c = Pawn.RaceProps.BloodDef.graphicData.color;
return c;
return Utility.BloodDef(Pawn).graphicData.color;
}
catch
{

View file

@ -340,14 +340,4 @@ namespace RJW_Menstruation
return;
}
}
[HarmonyPatch(typeof(Hediff_Pregnant), nameof(Hediff_Pregnant.Miscarry))]
public static class Miscarry_Patch
{
public static void Postfix(Hediff_Pregnant __instance)
{
HediffComp_PregeneratedBabies comp = __instance.TryGetComp<HediffComp_PregeneratedBabies>();
if (comp != null) comp.Miscarried();
}
}
}

View file

@ -14,9 +14,11 @@ namespace RJW_Menstruation
{
public static void Postfix(Hediff_Pregnant __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (comp == null) return;
comp.Pregnancy = null;
HediffComp_PregeneratedBabies babiesComp = __instance.TryGetComp<HediffComp_PregeneratedBabies>();
if (babiesComp != null) babiesComp.Miscarried();
HediffComp_Menstruation menstruationComp = __instance.GetMenstruationCompFromPregnancy();
if (menstruationComp != null) menstruationComp.Pregnancy = null;
}
}

View file

@ -61,6 +61,7 @@
<ItemGroup>
<Compile Include="Compatibility\AnimalGeneticsCompatibility.cs" />
<Compile Include="Compatibility\HARCompatibility.cs" />
<Compile Include="Compatibility\VECompatibility.cs" />
<Compile Include="CompBiosculpterPod_EggRestorationCycle.cs" />
<Compile Include="Configurations.cs" />
<Compile Include="Cum.cs" />
@ -159,6 +160,10 @@
<HintPath>..\..\..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.UIModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="VFECore">
<HintPath>..\..\..\..\..\..\..\..\workshop\content\294100\2023507013\1.5\Assemblies\VFECore.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.7.2">

View file

@ -457,5 +457,21 @@ namespace RJW_Menstruation
return Color.white;
}
}
public static ThingDef BloodDef(Pawn pawn)
{
if (pawn == null) return ThingDefOf.Filth_Blood;
ThingDef bloodDef = null;
if (Configurations.VEFActivated) bloodDef = VECompatibility.VEGeneBloodDef(pawn);
if (bloodDef != null) return bloodDef;
if (pawn.Dead && pawn.IsShambler) return MutantDefOf.Shambler.bloodDef;
if (pawn.IsMutant)
{
ThingDef mutantBloodDef = pawn.mutant.Def.bloodDef;
if (mutantBloodDef != null) return mutantBloodDef;
}
bloodDef = pawn.RaceProps?.BloodDef;
if (bloodDef != null) return bloodDef;
return ThingDefOf.Filth_Blood;
}
}
}

View file

@ -3,6 +3,7 @@ Version 1.5.0.0
- Updated Traditional Chinese translation by Hydrogen.
- Added Russian translation by Angra Mainyu.
- Inactive genes will no longer be applied to wombs.
- Menstrual blood will now use blood colors from Vanilla Expanded Genes.
- Fix babies becoming the wrong pawnkind in some scenarios.
Version 1.0.9.4