Compare commits

..

5 commits

7 changed files with 40 additions and 10 deletions

View file

@ -257,7 +257,7 @@ namespace RJW_Menstruation
}
}
// Scenario B: Pregnant, grow in the second half of first trimester
else if (Pawn.IsRJWPregnant())
else if (Pawn.IsRJWPregnant() || Pawn.IsBiotechPregnant())
{
float pregnancySize = Mathf.InverseLerp(breastGrowthStart, breastGrowthEnd, Pawn.GetFarthestPregnancyProgress()) * MaxBreastIncrement;
if (breastSizeIncreased > pregnancySize)
@ -293,7 +293,7 @@ namespace RJW_Menstruation
float newNippleProgress;
if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks)
newNippleProgress = 1f;
else if (Pawn.IsRJWPregnant())
else if (Pawn.IsRJWPregnant() || Pawn.IsBiotechPregnant())
newNippleProgress = nippleTransitions.Evaluate(Pawn.GetFarthestPregnancyProgress());
else
newNippleProgress = 0f;

View file

@ -362,5 +362,34 @@ namespace RJW_Menstruation
if (ModsConfig.BiotechActive && pawn.health.hediffSet.HasHediff(HediffDefOf.ImplantedIUD)) return true;
return false;
}
public static float DamagePants(this Pawn pawn, float fluidAmount)
{
if (pawn.apparel == null) return 0;
Apparel pants = null;
foreach(Apparel apparel in pawn.apparel.WornApparel.Where(app => app.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs)))
{
if (apparel.def.apparel.LastLayer == ApparelLayerDefOf.OnSkin)
{
pants = apparel;
break;
}
else if (pants == null || apparel.def.apparel.LastLayer == ApparelLayerDefOf.Middle)
// Either grab whatever's available or reassign the pants from shell to a middle
pants = apparel;
// Pants are middle and this is a shell
else continue;
}
if (pants == null) return 0;
const float HPPerMl = 0.5f;
DamageWorker.DamageResult damage = pants.TakeDamage(new DamageInfo(DamageDefOf.Deterioration, fluidAmount * HPPerMl, spawnFilth: false));
if (pants.Destroyed && PawnUtility.ShouldSendNotificationAbout(pawn) && !pawn.Dead)
Messages.Message("MessageWornApparelDeterioratedAway".Translate(GenLabel.ThingLabel(pants.def, pants.Stuff), pawn).CapitalizeFirst(), pawn, MessageTypeDefOf.NegativeEvent);
return damage.totalDamageDealt;
}
}
}

View file

@ -426,10 +426,10 @@ namespace RJW_Menstruation
}
if (division > 1)
{
if (baby.IsHAR()) // necessary for HAR to decide on graphical properties pre-birth
baby.Drawer.renderer.graphics.ResolveAllGraphics();
if (i == 0)
{
{
if (baby.IsHAR()) // Have HAR determine the first baby's properties
baby.Drawer.renderer.graphics.ResolveAllGraphics();
firstbaby = baby;
request.FixedGender = baby.gender;
request.ForcedEndogenes = baby.genes?.Endogenes.Select(gene => gene.def).ToList();

View file

@ -141,7 +141,7 @@ namespace RJW_Menstruation
// Also called for Recipe_TerminatePregnancy.ApplyOnPawn
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
if (GetPregnancyHediff == null) throw new System.InvalidOperationException("GetPregnancyHediff not found");
if (GetPregnancyHediff == null || GetPregnancyHediff.ReturnType != typeof(Hediff)) throw new System.InvalidOperationException("GetPregnancyHediff not found");
foreach (CodeInstruction instruction in instructions)
{
if (instruction.Calls(GetPregnancyHediff))

View file

@ -132,7 +132,7 @@ namespace RJW_Menstruation
private static readonly MethodInfo IsPregnant = AccessTools.Method(typeof(PawnExtensions), nameof(PawnExtensions.IsPregnant), new System.Type[] {typeof(Pawn), typeof(bool)});
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
if (IsPregnant == null) throw new System.InvalidOperationException("IsPregnant not found");
if (IsPregnant == null || IsPregnant.ReturnType != typeof(bool)) throw new System.InvalidOperationException("IsPregnant not found");
foreach(CodeInstruction instruction in instructions)
{
if (instruction.Calls(IsPregnant))
@ -239,7 +239,7 @@ namespace RJW_Menstruation
private static readonly FieldInfo MinimumFuckabilityToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumFuckabilityToHookup));
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
if (MinimumFuckabilityToHookup == null) throw new System.InvalidOperationException("MinimumFuckabilityToHookup not found");
if (MinimumFuckabilityToHookup == null || MinimumFuckabilityToHookup.FieldType != typeof(float)) throw new System.InvalidOperationException("MinimumFuckabilityToHookup not found");
bool first_fuckability = true;
foreach (CodeInstruction instruction in instructions)
{
@ -275,8 +275,8 @@ namespace RJW_Menstruation
private static readonly FieldInfo MinimumRelationshipToHookup = AccessTools.Field(typeof(RJWHookupSettings), nameof(RJWHookupSettings.MinimumRelationshipToHookup));
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
if (MinimumAttractivenessToHookup == null) throw new System.InvalidOperationException("MinimumAttractivenessToHookup not found");
if (MinimumRelationshipToHookup == null) throw new System.InvalidOperationException("MinimumRelationshipToHookup not found");
if (MinimumAttractivenessToHookup == null || MinimumAttractivenessToHookup.FieldType != typeof(float)) throw new System.InvalidOperationException("MinimumAttractivenessToHookup not found");
if (MinimumRelationshipToHookup == null || MinimumRelationshipToHookup.FieldType != typeof(float)) throw new System.InvalidOperationException("MinimumRelationshipToHookup not found");
LocalBuilder pawn_index = null;
// Like in the last one, we switch the arguments around for the second load
bool first_attractiveness = true;

View file

@ -1,5 +1,6 @@
Version 1.0.8.4
- Fix Biotech xenotype inheritance for single-child pregnancies.
- Fix error in Traditional Chinese translation.
- Newborns should now be baseliners if there are no xenotypes to inherit.
- The Biotech terminate pregnancy recipe can now terminate a menstruation pregnancy, too.