Compare commits

...

4 commits

6 changed files with 35 additions and 31 deletions

Binary file not shown.

View file

@ -19,23 +19,16 @@ namespace RJW_Menstruation
AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp<AlienPartGenerator.AlienComp>();
AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp<AlienPartGenerator.AlienComp>();
if (babyHARComp == null || originalHARComp == null) return;
foreach(KeyValuePair<string, AlienPartGenerator.ExposableValueTuple<Color, Color>> channel in originalHARComp.ColorChannels)
babyHARComp.addonVariants = new List<int>(originalHARComp.addonVariants);
foreach (KeyValuePair<string, AlienPartGenerator.ExposableValueTuple<Color, Color>> channel in originalHARComp.ColorChannels)
{
babyHARComp.OverwriteColorChannel(channel.Key, channel.Value.first, channel.Value.second);
}
babyHARComp.headVariant = originalHARComp.headVariant;
babyHARComp.bodyVariant = originalHARComp.bodyVariant;
babyHARComp.headMaskVariant = originalHARComp.headMaskVariant;
babyHARComp.bodyMaskVariant = originalHARComp.bodyMaskVariant;
}
// HAR doesn't populate variants until the graphics are called for, so this has to happen late
public static void CopyHARPropertiesPostBirth(Pawn baby, Pawn original)
{
AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp<AlienPartGenerator.AlienComp>();
AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp<AlienPartGenerator.AlienComp>();
if (babyHARComp == null || originalHARComp == null) return;
if (originalHARComp.addonVariants != null) // Testing has shown that the addons are valid by this point, but it's better to be safe
babyHARComp.addonVariants = new List<int>(originalHARComp.addonVariants);
}
}
}

View file

@ -244,8 +244,6 @@ namespace RJW_Menstruation
CopyBodyPartRecord(baby, original, Genital_Helper.get_breastsBPR(baby), Genital_Helper.get_breastsBPR(original));
CopyBodyPartRecord(baby, original, Genital_Helper.get_uddersBPR(baby), Genital_Helper.get_uddersBPR(original));
CopyBodyPartRecord(baby, original, Genital_Helper.get_anusBPR(baby), Genital_Helper.get_anusBPR(original));
if (baby.IsHAR())
HARCompatibility.CopyHARPropertiesPostBirth(baby, original);
}
public override void PostBirth(Pawn mother, Pawn father, Pawn baby)
@ -411,28 +409,30 @@ namespace RJW_Menstruation
{
Pawn baby = GenerateBaby(request, mother, father, parentTraits, traitSeed);
if (baby == null) break;
if (baby.genes != null && ModsConfig.BiotechActive)
{
if (GeneUtility.SameHeritableXenotype(mother, father) && mother.genes.UniqueXenotype)
{
baby.genes.xenotypeName = mother.genes.xenotypeName;
baby.genes.iconDef = mother.genes.iconDef;
}
XenotypeDef xenoTypeDef = BabyXenoTypeDecider(mother, father, out bool hybridBaby);
if (xenoTypeDef != null) baby.genes.SetXenotypeDirect(xenoTypeDef);
if (hybridBaby)
{
baby.genes.hybrid = true;
baby.genes.xenotypeName = "Hybrid".Translate();
}
}
if (division > 1)
{
if (baby.IsHAR()) // necessary for HAR to decide on graphical properties pre-birth
baby.Drawer.renderer.graphics.ResolveAllGraphics();
if (i == 0)
{
firstbaby = baby;
request.FixedGender = baby.gender;
request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
if (baby.genes != null && ModsConfig.BiotechActive)
{
if (GeneUtility.SameHeritableXenotype(mother, father) && mother.genes.UniqueXenotype)
{
baby.genes.xenotypeName = mother.genes.xenotypeName;
baby.genes.iconDef = mother.genes.iconDef;
}
XenotypeDef xenoTypeDef = BabyXenoTypeDecider(mother, father, out bool hybridBaby);
if (xenoTypeDef != null) baby.genes.SetXenotypeDirect(xenoTypeDef);
if(hybridBaby)
{
baby.genes.hybrid = true;
baby.genes.xenotypeName = "Hybrid".Translate();
}
}
request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();
}
else
{

View file

@ -110,6 +110,16 @@ namespace RJW_Menstruation
}
}
[HarmonyPatch(typeof(PregnancyUtility), nameof(PregnancyUtility.ApplyBirthOutcome))]
public class ApplyBirthOutcome_Patch
{
public static void PostFix(Thing birtherThing)
{
if (birtherThing is Pawn pawn && !pawn.health.Dead)
pawn.GetBreastComp()?.GaveBirth();
}
}
[HarmonyPatch(typeof(PregnancyUtility), nameof(PregnancyUtility.TryTerminatePregnancy))]
public class TryTerminatePregnancy_Patch
{

View file

@ -1,4 +1,5 @@
Version 1.0.8.4
- Fix Biotech xenotype inheritance for single-child pregnancies.
- Newborns should now be baseliners if there are no xenotypes to inherit.
- The Biotech terminate pregnancy recipe can now terminate a menstruation pregnancy, too.
@ -17,7 +18,7 @@ Version 1.0.8.2
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.
- Properly track Biotech pregnancy through labor.
- Pawns that are genetically sterile will no longer produce fertile cum, nor have a menstrual cycle.
- Biotech IUDs will now reduce pregnancy chances the same as an RJW IUD. Using both will not stack.
- A biotech pregnancy will pause before going into labor if another womb already is in labor.