diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index 0020d86..7da77a7 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -276,7 +276,10 @@ namespace RJW_Menstruation float res = 0; if (VariousDefOf.Hediff_Heavy_Lactating_Permanent != null) { - if (pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Heavy_Lactating_Permanent)) milkcomp = pawn.AllComps.FirstOrDefault(x => x.GetType().ToString().ToLower().Contains("hypermilkable")); + if (pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Heavy_Lactating_Permanent) + || pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Lactating_Permanent) + || pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Lactating_Natural) + || pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Lactating_Drug)) milkcomp = pawn.AllComps.FirstOrDefault(x => x.GetType().ToString().ToLower().Contains("milkablehuman")); else milkcomp = pawn.AllComps.FirstOrDefault(x => x.GetType().ToString().ToLower().Contains("milkable")); } else diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs index 16903b2..a3fdf4c 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs @@ -158,7 +158,7 @@ namespace RJW_Menstruation public static readonly HediffDef Hediff_Lactating_Natural = DefDatabase.GetNamedSilentFail("Lactating_Natural"); public static readonly HediffDef Hediff_Lactating_Permanent = DefDatabase.GetNamedSilentFail("Lactating_Permanent"); public static readonly HediffDef Hediff_Heavy_Lactating_Permanent = DefDatabase.GetNamedSilentFail("Heavy_Lactating_Permanent"); - public static readonly JobDef Job_LactateSelf_MC = DefDatabase.GetNamedSilentFail("LactateSelf_MC"); + public static readonly JobDef Job_LactateSelf_MC = DefDatabase.GetNamedSilentFail("MilkSelf"); // Defs from Sexperience Ideology public static readonly PreceptDef Pregnancy_Elevated = DefDatabase.GetNamedSilentFail("Pregnancy_Elevated"); diff --git a/1.5/Assemblies/RJW_Menstruation.dll b/1.5/Assemblies/RJW_Menstruation.dll index dc9122f..10ddb96 100644 Binary files a/1.5/Assemblies/RJW_Menstruation.dll and b/1.5/Assemblies/RJW_Menstruation.dll differ diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/Compatibility/VECompatibility.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/Compatibility/VECompatibility.cs new file mode 100644 index 0000000..b8ab374 --- /dev/null +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/Compatibility/VECompatibility.cs @@ -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()?.customBloodThingDef; + if (bloodDef != null) return bloodDef; + } + return null; + } + } +} diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs index 72724c0..5fcb4f9 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs @@ -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"); } diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index ffb4296..d70909d 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -554,8 +554,7 @@ namespace RJW_Menstruation { try { - Color c = Pawn.RaceProps.BloodDef.graphicData.color; - return c; + return Utility.BloodDef(Pawn).graphicData.color; } catch { diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs index ef877e1..e687cb7 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs @@ -161,6 +161,13 @@ namespace RJW_Menstruation } } } + + public void Miscarried() + { + if (babies == null) return; + foreach (Pawn baby in babies) + baby.Destroy(DestroyMode.Vanish); + } } [HarmonyPatch(typeof(PregnancyUtility), nameof(PregnancyUtility.ApplyBirthOutcome_NewTemp))] diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index a84bb1a..e8d6939 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -38,6 +38,9 @@ namespace RJW_Menstruation public override void Miscarry() { this.GetMenstruationCompFromPregnancy().Pregnancy = null; + if (babies != null) + foreach (var baby in babies) + baby.Destroy(DestroyMode.Vanish); base.Miscarry(); } diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs index 7f5468f..f9525df 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs @@ -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(); + if (babiesComp != null) babiesComp.Miscarried(); + + HediffComp_Menstruation menstruationComp = __instance.GetMenstruationCompFromPregnancy(); + if (menstruationComp != null) menstruationComp.Pregnancy = null; } } diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj b/1.5/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj index cef7a71..eaddf37 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj @@ -61,6 +61,7 @@ + @@ -159,6 +160,10 @@ ..\..\..\..\..\..\RimWorldWin64_Data\Managed\UnityEngine.UIModule.dll False + + ..\..\..\..\..\..\..\..\workshop\content\294100\2023507013\1.5\Assemblies\VFECore.dll + False + diff --git a/1.5/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.5/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index dfa13d5..87401eb 100644 --- a/1.5/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.5/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -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; + } } } diff --git a/changelogs.txt b/changelogs.txt index 69522ab..cbe7819 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -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