Compare commits

..

No commits in common. "ea1c5794f950cf2fce123b7dbe98fab505c5c37c" and "483ab2f7c068f96cb1fe59911038e20f8f2429be" have entirely different histories.

6 changed files with 0 additions and 123 deletions

Binary file not shown.

View file

@ -439,20 +439,6 @@ namespace RJW_Menstruation
firstbaby = baby;
request.FixedGender = baby.gender;
request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
if (GeneUtility.SameHeritableXenotype(mother, father) && mother.genes.UniqueXenotype)
{
baby.genes.xenotypeName = mother.genes.xenotypeName;
baby.genes.iconDef = mother.genes.iconDef;
}
if (baby.genes != null)
{
baby.genes.SetXenotypeDirect(BabyXenoTypeDecider(mother, father, out bool hybridBaby));
if(hybridBaby)
{
baby.genes.hybrid = true;
baby.genes.xenotypeName = "Hybrid".Translate();
}
}
}
else
{
@ -465,14 +451,6 @@ namespace RJW_Menstruation
baby.story.bodyType = firstbaby.story.bodyType;
}
if (baby.genes != null)
{
baby.genes.SetXenotypeDirect(firstbaby.genes.Xenotype);
baby.genes.xenotypeName = firstbaby.genes.xenotypeName;
baby.genes.iconDef = firstbaby.genes.iconDef;
baby.genes.hybrid = firstbaby.genes.hybrid;
}
if (baby.IsHAR())
HARCompatibility.CopyHARProperties(baby, firstbaby);
//if (Configurations.AnimalGeneticsActivated)
@ -643,39 +621,6 @@ namespace RJW_Menstruation
}
public XenotypeDef BabyXenoTypeDecider(Pawn mother, Pawn father, out bool hybrid)
{
hybrid = false;
bool hybridMother = mother?.genes?.hybrid ?? false;
bool hybridFather = father?.genes?.hybrid ?? false;
if (hybridMother && hybridFather)
{
hybrid = true;
return null;
}
XenotypeDef motherInheritableXenotype = mother?.genes?.Xenotype;
XenotypeDef fatherInheritableXenotype = father?.genes?.Xenotype;
if (!motherInheritableXenotype.inheritable) motherInheritableXenotype = null;
if (!fatherInheritableXenotype.inheritable) fatherInheritableXenotype = null;
// If they're the same (or both null)
if (motherInheritableXenotype == fatherInheritableXenotype)
{
// Both null, but one's a hybrid
if (motherInheritableXenotype == null && (hybridMother || hybridFather))
hybrid = true;
return motherInheritableXenotype;
}
// If one is null and the other isn't
if ((motherInheritableXenotype == null) != (fatherInheritableXenotype == null)) return motherInheritableXenotype ?? fatherInheritableXenotype;
// So two different inheritable ones
hybrid = true;
return null;
}
public PawnKindDef GetHybrid(Pawn first, Pawn second)
{
PawnKindDef res = null;

View file

@ -1,64 +0,0 @@
using HarmonyLib;
using System.Linq;
using RimWorld;
using Verse;
namespace RJW_Menstruation
{
[HarmonyPatch(typeof(Hediff_Pregnant), "Miscarry")]
public class Miscarry_Patch
{
public static void Postfix(Hediff_Pregnant __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (comp == null) return;
comp.Pregnancy = null;
}
}
[HarmonyPatch(typeof(Hediff_Pregnant), nameof(Hediff_Pregnant.StartLabor))]
public class StartLabor_Patch
{
public static void Postfix(Hediff_Pregnant __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (comp == null) return;
comp.Pregnancy = __instance.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PregnancyLabor);
}
}
[HarmonyPatch(typeof(Hediff_Labor), nameof(Hediff_Labor.PreRemoved))]
public class Labor_PreRemoved_Patch
{
public static void PostFix(Hediff_Labor __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (comp == null) return;
comp.Pregnancy = __instance.pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.PregnancyLaborPushing);
}
}
[HarmonyPatch(typeof(Hediff_LaborPushing), nameof(Hediff_LaborPushing.PreRemoved))]
public class LaborPushing_PreRemoved_Patch
{
public static void PostFix(Hediff_LaborPushing __instance)
{
HediffComp_Menstruation comp = __instance.GetMenstruationCompFromPregnancy();
if (comp == null) return;
comp.Pregnancy = null;
}
}
// Prevents a pregnancy from going into labor if another pregnancy already is
[HarmonyPatch(typeof(Hediff_Pregnant), nameof(Hediff_Pregnant.GestationProgress), MethodType.Getter)]
public class Hediff_Pregnant_GestationProgess_Patch
{
public static void PostFix(Hediff_Pregnant __instance, ref float __result)
{
if (__result < 1f) return;
Pawn pawn = __instance.pawn;
if (pawn.health.hediffSet.hediffs.Any(hediff => hediff.def == HediffDefOf.PregnancyLabor || hediff.def == HediffDefOf.PregnancyLaborPushing))
__result = 0.999f;
}
}
}

View file

@ -70,7 +70,6 @@
<Compile Include="HediffComps\MenstruationUtility.cs" />
<Compile Include="Hediff_Estrus.cs" />
<Compile Include="IngestionOutcomeDoers.cs" />
<Compile Include="Patch\Biotech_Patch.cs" />
<Compile Include="Patch\GC_Patch.cs" />
<Compile Include="Recipe_Surgery.cs" />
<Compile Include="StatParts.cs" />

View file

@ -1,8 +1,5 @@
Version 1.0.8.1
- Added the option for humans to start Biotech pregnancies if the DLC is enabled. If set, non-humans will use the old multiple pregnancy instead.
- Babies conceived through the multiple pregnancy option will now properly inherit xenotypes.
- Properly track biotech pregnancy through labor.
- A biotech pregnancy will pause before going into labor if another womb already is in labor.
Version 1.0.8.0
- Support for RimWorld 1.4. All future changes to Menstruation will only be for Rimworld 1.4.