diff --git a/1.3/Assemblies/RJW_Menstruation.dll b/1.3/Assemblies/RJW_Menstruation.dll index 8477c8f..07cae08 100644 Binary files a/1.3/Assemblies/RJW_Menstruation.dll and b/1.3/Assemblies/RJW_Menstruation.dll differ diff --git a/1.3/SexperienceModule/Assemblies/SexperienceModule.dll b/1.3/SexperienceModule/Assemblies/SexperienceModule.dll index 308d693..9675156 100644 Binary files a/1.3/SexperienceModule/Assemblies/SexperienceModule.dll and b/1.3/SexperienceModule/Assemblies/SexperienceModule.dll differ diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs index 20af3cc..5b7caa5 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs @@ -68,7 +68,7 @@ namespace RJW_Menstruation get { if (babyHalfAge > 0f) return babyHalfAge; - List ages = parent.pawn.def.race.lifeStageAges; + List ages = Pawn.def.race.lifeStageAges; if (ages?.Count > 1) babyHalfAge = ages[1].minAge / 2; @@ -165,8 +165,8 @@ namespace RJW_Menstruation try { if ( - !parent.pawn.IsHashIntervalTick(tickInterval) || - !parent.pawn.Spawned // TODO: Add option to simulate off-map pawns + !Pawn.IsHashIntervalTick(tickInterval) || + !Pawn.Spawned // TODO: Add option to simulate off-map pawns ) { return; @@ -177,7 +177,7 @@ namespace RJW_Menstruation } catch (Exception ex) { - Log.Error($"Error processing breasts of {parent.pawn}: {ex}"); + Log.Error($"Error processing breasts of {Pawn}: {ex}"); } } @@ -185,14 +185,14 @@ namespace RJW_Menstruation public override void CompPostPostAdd(DamageInfo? dinfo) { if (!loaded) Initialize(); - if (ageOfLastBirth > parent.pawn.ageTracker.AgeChronologicalTicks) ageOfLastBirth = CalculateLastBirth(); // catch transplant issues + if (ageOfLastBirth > Pawn.ageTracker.AgeChronologicalTicks) ageOfLastBirth = CalculateLastBirth(); // catch transplant issues } public override void CompPostPostRemoved() { - if (parent.pawn.health.hediffSet.hediffs.Contains(parent)) + if (Pawn.health.hediffSet.hediffs.Contains(parent)) { - Log.Warning($"Attempted to remove breast comp from wrong pawn ({parent.pawn})."); + Log.Warning($"Attempted to remove breast comp from wrong pawn ({Pawn})."); return; } base.CompPostPostRemoved(); @@ -201,23 +201,23 @@ namespace RJW_Menstruation protected long CalculateLastBirth() { long youngestAge = (long)(BabyHalfAge * GenDate.TicksPerYear) * -2; // So a newborn isn't considered a new mother, either - if ((parent.pawn.relations?.ChildrenCount ?? 0) > 0) + if ((Pawn.relations?.ChildrenCount ?? 0) > 0) { - foreach (Pawn child in parent.pawn.relations.Children) + foreach (Pawn child in Pawn.relations.Children) { bool isFetus = false; - if (parent.pawn.health.hediffSet.GetHediffs().Any(preg => preg.babies.Contains(child))) + if (Pawn.health.hediffSet.GetHediffs().Any(preg => preg.babies.Contains(child))) { isFetus = true; break; } if ( - parent.pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks > ageOfLastBirth && + Pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks > ageOfLastBirth && !isFetus && - child.GetMother() == parent.pawn // Don't do Dad's boobs + child.GetMother() == Pawn // Don't do Dad's boobs ) - youngestAge = parent.pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks; + youngestAge = Pawn.ageTracker.BirthAbsTicks - child.ageTracker.BirthAbsTicks; } } return youngestAge; @@ -254,7 +254,7 @@ namespace RJW_Menstruation protected void CalculateBreastSize() { // Scenario A: the youngest child is less than halfway into babyhood: Full size - if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > parent.pawn.ageTracker.AgeBiologicalTicks) + if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks) { debugGrowthStatus = "Full size due to young child"; if (breastSizeIncreased < MaxBreastIncrement) @@ -264,9 +264,9 @@ namespace RJW_Menstruation } } // Scenario B: Pregnant, grow in the second half of first trimester - else if (parent.pawn.IsRJWPregnant()) + else if (Pawn.IsRJWPregnant()) { - float pregnancySize = Mathf.InverseLerp(breastGrowthStart, breastGrowthEnd, parent.pawn.GetFarthestPregnancyProgress()) * MaxBreastIncrement; + float pregnancySize = Mathf.InverseLerp(breastGrowthStart, breastGrowthEnd, Pawn.GetFarthestPregnancyProgress()) * MaxBreastIncrement; if (breastSizeIncreased > pregnancySize) { debugGrowthStatus = "Shrinking due to being oversize for pregnancy"; @@ -298,10 +298,10 @@ namespace RJW_Menstruation protected void CalculateNipples() { float newNippleProgress; - if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > parent.pawn.ageTracker.AgeBiologicalTicks) + if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks) newNippleProgress = 1f; - else if (parent.pawn.IsRJWPregnant()) - newNippleProgress = nippleTransitions.Evaluate(parent.pawn.GetFarthestPregnancyProgress()); + else if (Pawn.IsRJWPregnant()) + newNippleProgress = nippleTransitions.Evaluate(Pawn.GetFarthestPregnancyProgress()); else newNippleProgress = 0f; @@ -353,7 +353,7 @@ namespace RJW_Menstruation cachedNipple = baseNipple + nippleProgress * nippleChange; // For some reason, Props can go null when RJW relocates the chest (e.g. some animals), so catch that - cachedColor = Colors.CMYKLerp(parent.pawn.story?.SkinColor ?? Color.white, (Props?.BlackNippleColor ?? CompProperties_Breast.DefaultBlacknippleColor.ToColor), Alpha); + cachedColor = Colors.CMYKLerp(Pawn.story?.SkinColor ?? Color.white, (Props?.BlackNippleColor ?? CompProperties_Breast.DefaultBlacknippleColor.ToColor), Alpha); } public void CopyBreastProperties(HediffComp_Breast original) diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs index 91be3e1..9019340 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs @@ -75,7 +75,7 @@ namespace RJW_Menstruation { get { - if (parent.pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false; + if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false; switch (curStage) { diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index 186c044..4de9e36 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -124,7 +124,7 @@ namespace RJW_Menstruation get { if (pregnancy == null) return null; - else if (!parent.pawn.health.hediffSet.hediffs.Contains(pregnancy)) + else if (!Pawn.health.hediffSet.hediffs.Contains(pregnancy)) { pregnancy = null; return null; @@ -143,7 +143,7 @@ namespace RJW_Menstruation float avglittersize; try { - avglittersize = Mathf.Max(Rand.ByCurveAverage(parent.pawn.def.race.litterSizeCurve), 1.0f); + avglittersize = Mathf.Max(Rand.ByCurveAverage(Pawn.def.race.litterSizeCurve), 1.0f); } catch { @@ -153,7 +153,7 @@ namespace RJW_Menstruation opcache = (int)(RaceCyclesPerYear() * avglittersize * 6f * - (parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy)); + (Pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy)); return opcache; } } @@ -186,7 +186,7 @@ namespace RJW_Menstruation { get { - float res = Props.maxCumCapacity * parent.pawn.BodySize; + float res = Props.maxCumCapacity * Pawn.BodySize; if (curStage != Stage.Pregnant || (pregnancy?.Severity ?? 0f) < 0.175f) res *= 500f; return res; } @@ -196,7 +196,7 @@ namespace RJW_Menstruation { get { - if (xxx.has_quirk(parent.pawn, "Breeder")) return 0.5f; + if (xxx.has_quirk(Pawn, "Breeder")) return 0.5f; return 1.0f; } @@ -207,8 +207,8 @@ namespace RJW_Menstruation get { float factor = 1.0f; - if (parent.pawn.Has(Quirk.Breeder)) factor = 10.0f; - return parent.pawn.health.capacities.GetLevel(xxx.reproduction) * Props.baseImplantationChanceFactor * factor; + if (Pawn.Has(Quirk.Breeder)) factor = 10.0f; + return Pawn.health.capacities.GetLevel(xxx.reproduction) * Props.baseImplantationChanceFactor * factor; } } public IEnumerable GetCumsInfo @@ -420,7 +420,7 @@ namespace RJW_Menstruation { get { - if (parent.pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false; + if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) return false; switch (curStage) { @@ -451,7 +451,7 @@ namespace RJW_Menstruation { try { - Color c = parent.pawn.def.race.BloodDef.graphicData.color; + Color c = Pawn.def.race.BloodDef.graphicData.color; return c; } catch @@ -467,7 +467,7 @@ namespace RJW_Menstruation { if (breastcache == null) { - breastcache = parent.pawn.GetBreastComp(); + breastcache = Pawn.GetBreastComp(); } return breastcache; } @@ -506,8 +506,8 @@ namespace RJW_Menstruation // Luteal will appear to progress, hitting the end of the phase when the pregnancy is discovered float discoveryTime = 0.5f; - if (parent.pawn.story?.bodyType == BodyTypeDefOf.Thin) discoveryTime = 0.25f; - else if (parent.pawn.story?.bodyType == BodyTypeDefOf.Female) discoveryTime = 0.35f; + if (Pawn.story?.bodyType == BodyTypeDefOf.Thin) discoveryTime = 0.25f; + else if (Pawn.story?.bodyType == BodyTypeDefOf.Female) discoveryTime = 0.35f; // Estimated; there's no way to get the exact value after the fact without writing it into the save float lutealProgressWhenImplanted = Math.Min(0.5f, maxImplantDelayHours / (Props.lutealIntervalDays * 24)); @@ -559,16 +559,16 @@ namespace RJW_Menstruation try { if ( - !parent.pawn.IsHashIntervalTick(tickInterval) || - !parent.pawn.Spawned || // TODO: Add option to simulate off-map pawns - (parent.pawn.IsAnimal() && !Configurations.EnableAnimalCycle) + !Pawn.IsHashIntervalTick(tickInterval) || + !Pawn.Spawned || // TODO: Add option to simulate off-map pawns + (Pawn.IsAnimal() && !Configurations.EnableAnimalCycle) ) { return; } CumOut(); - if (pregnancy == null && parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Young; + if (pregnancy == null && Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Young; switch (curStage) { case Stage.Follicular: @@ -614,7 +614,7 @@ namespace RJW_Menstruation } catch (Exception ex) { - Log.Error($"Error processing womb of {parent.pawn}: {ex}"); + Log.Error($"Error processing womb of {Pawn}: {ex}"); } } @@ -622,9 +622,9 @@ namespace RJW_Menstruation { // If a hediff is removed from a pawn that does not have it, CompPostPostRemoved is still called on the pawn that does. // If it was a legitimate removal, then it won't be in this pawn's hediff list anymore, as that removal occurs first - if (parent.pawn.health.hediffSet.hediffs.Contains(parent)) + if (Pawn.health.hediffSet.hediffs.Contains(parent)) { - Log.Warning($"Attempted to remove menstruation comp from wrong pawn ({parent.pawn})."); + Log.Warning($"Attempted to remove menstruation comp from wrong pawn ({Pawn})."); return; } if (!(pregnancy is Hediff_MechanoidPregnancy)) @@ -667,7 +667,7 @@ namespace RJW_Menstruation public void CumIn(Pawn pawn, float volume, float fertility = 1.0f, ThingDef filthdef = null) { if (volume <= 0) return; - if (parent.pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) fertility /= 100f; + if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) fertility /= 100f; float cumd = TotalCumPercent; float tmp = TotalCum + volume; if (tmp > CumCapacity) @@ -701,7 +701,7 @@ namespace RJW_Menstruation } cumd = TotalCumPercent - cumd; - parent.pawn.records.AddTo(VariousDefOf.AmountofCreampied, volume); + Pawn.records.AddTo(VariousDefOf.AmountofCreampied, volume); AfterCumIn(pawn); AfterFluidIn(cumd); } @@ -777,13 +777,13 @@ namespace RJW_Menstruation protected void BeforeCumOut(out Absorber absorber) { - Hediff asa = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_ASA); + Hediff asa = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_ASA); float asafactor = asa?.Severity ?? 0f; - if (parent.pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) antisperm = 0.70f + asafactor; + if (Pawn.health.hediffSet.HasHediff(VariousDefOf.RJW_IUD)) antisperm = 0.70f + asafactor; else antisperm = 0.0f + asafactor; - absorber = (Absorber)parent.pawn.apparel?.WornApparel?.Find(x => x is Absorber); + absorber = (Absorber)Pawn.apparel?.WornApparel?.Find(x => x is Absorber); if (absorber != null) { absorber.WearEffect(); @@ -796,7 +796,7 @@ namespace RJW_Menstruation /// protected virtual void AfterCumOut() { - parent.pawn.needs?.mood?.thoughts?.memories?.TryGainMemory(VariousDefOf.LeakingFluids); + Pawn.needs?.mood?.thoughts?.memories?.TryGainMemory(VariousDefOf.LeakingFluids); } /// @@ -822,13 +822,13 @@ namespace RJW_Menstruation List filthlabels = new List(); BeforeCumOut(out Absorber absorber); if (cums.NullOrEmpty()) return; - if (TotalCum > Props.maxCumCapacity * parent.pawn.BodySize) leakfactor = Math.Min(1 + (TotalCum - Props.maxCumCapacity * parent.pawn.BodySize) / 10, 2f); + if (TotalCum > Props.maxCumCapacity * Pawn.BodySize) leakfactor = Math.Min(1 + (TotalCum - Props.maxCumCapacity * Pawn.BodySize) / 10, 2f); if (absorber != null && absorber.dirty && !absorber.LeakAfterDirty) leakfactor = 0f; - if (parent.pawn.jobs?.curJob?.def == xxx.knotted) leakfactor = 0f; + if (Pawn.jobs?.curJob?.def == xxx.knotted) leakfactor = 0f; List removecums = new List(); foreach (Cum cum in cums) { - cum.CumEffects(parent.pawn); + cum.CumEffects(Pawn); float vd = cum.DismishNatural(leakfactor, antisperm); cum.MakeThinner(Configurations.CycleAcceleration); totalleak += AbsorbCum(vd, absorber); @@ -913,7 +913,7 @@ namespace RJW_Menstruation cums.Remove(cum); } removecums.Clear(); - return new CumMixture(parent.pawn, totalleak, cumlabels, color, mixtureDef, pure); + return new CumMixture(Pawn, totalleak, cumlabels, color, mixtureDef, pure); } /// @@ -959,7 +959,7 @@ namespace RJW_Menstruation if (cycleVariability < 0f) cycleVariability = MenstruationUtility.RandomVariabilityPercent(); if (currentIntervalHours < 0) { - if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Young; + if (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) curStage = Stage.Young; else if (!IsBreedingSeason()) curStage = Stage.Anestrus; else curStage = RandomStage(); if (curStage == Stage.Follicular) @@ -979,7 +979,7 @@ namespace RJW_Menstruation if (pregnancy == null) { // If this womb isn't marked pregnant, search for pregnancies that have no womb and claim one - foreach (Hediff_BasePregnancy preg in parent.pawn.health.hediffSet.GetHediffs()) + foreach (Hediff_BasePregnancy preg in Pawn.health.hediffSet.GetHediffs()) { if (preg.GetMenstruationComp() == null) { @@ -991,7 +991,7 @@ namespace RJW_Menstruation } } - //Log.Message(parent.pawn.Label + " - Initialized menstruation comp"); + //Log.Message(Pawn.Label + " - Initialized menstruation comp"); loaded = true; } @@ -1017,19 +1017,18 @@ namespace RJW_Menstruation public int GetOvaryPowerByAge() { - Pawn pawn = parent.pawn; float avglittersize; try { - avglittersize = Mathf.Max(Rand.ByCurveAverage(pawn.def.race.litterSizeCurve), 1.0f); + avglittersize = Mathf.Max(Rand.ByCurveAverage(Pawn.def.race.litterSizeCurve), 1.0f); } catch (NullReferenceException) { avglittersize = 1.0f; } - float fertStartAge = pawn.RaceProps.lifeStageAges?.Find(stage => stage.def.reproductive)?.minAge ?? 0.0f; - float fertEndAge = pawn.RaceProps.lifeExpectancy * (pawn.IsAnimal() ? RJWPregnancySettings.fertility_endage_female_animal : RJWPregnancySettings.fertility_endage_female_humanlike); + float fertStartAge = Pawn.RaceProps.lifeStageAges?.Find(stage => stage.def.reproductive)?.minAge ?? 0.0f; + float fertEndAge = Pawn.RaceProps.lifeExpectancy * (Pawn.IsAnimal() ? RJWPregnancySettings.fertility_endage_female_animal : RJWPregnancySettings.fertility_endage_female_humanlike); if (fertEndAge < fertStartAge) fertEndAge = fertStartAge; float raceCyclesPerYear = RaceCyclesPerYear(); @@ -1037,7 +1036,7 @@ namespace RJW_Menstruation int lifetimeEggs = (int)(lifetimeCycles * avglittersize * Utility.RandGaussianLike(0.70f, 1.30f, 5)); float pawnCyclesPerYear = raceCyclesPerYear * cycleSpeed; - float pawnCyclesElapsed = Mathf.Max((pawn.ageTracker.AgeBiologicalYearsFloat - fertStartAge) * pawnCyclesPerYear, 0.0f); + float pawnCyclesElapsed = Mathf.Max((Pawn.ageTracker.AgeBiologicalYearsFloat - fertStartAge) * pawnCyclesPerYear, 0.0f); int pawnEggsUsed = PawnEggsUsed(pawnCyclesElapsed, avglittersize); return Math.Max(lifetimeEggs - pawnEggsUsed, 0); @@ -1054,16 +1053,16 @@ namespace RJW_Menstruation ovarypower = GetOvaryPowerByAge(); if (ovarypower < 1) { - Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn); + Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, Pawn); hediff.Severity = 0.2f; - parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn)); + Pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(Pawn)); curStage = Stage.Young; } else if (ovarypower < OvaryPowerThreshold) { - Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Climacteric, parent.pawn); + Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Climacteric, Pawn); hediff.Severity = Mathf.InverseLerp(OvaryPowerThreshold, 0, ovarypower); - parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn)); + Pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(Pawn)); } } } @@ -1082,7 +1081,7 @@ namespace RJW_Menstruation { if (Configurations.EnableMenopause && ovarypower < OvaryPowerThreshold) { - if (sexNeed == null) sexNeed = parent.pawn.needs.TryGetNeed(VariousDefOf.SexNeed); + if (sexNeed == null) sexNeed = Pawn.needs.TryGetNeed(VariousDefOf.SexNeed); else { if (sexNeed.CurLevel < 0.5) sexNeed.CurLevel += 0.01f; @@ -1093,16 +1092,16 @@ namespace RJW_Menstruation public void SetEstrus(int days) { HediffDef estrusdef = Props.concealedEstrus ? VariousDefOf.Hediff_Estrus_Concealed : VariousDefOf.Hediff_Estrus; - Hediff hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(estrusdef); + Hediff hediff = Pawn.health.hediffSet.GetFirstHediffOfDef(estrusdef); if (Props.concealedEstrus) { - if (parent.pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Estrus)) return; + if (Pawn.health.hediffSet.HasHediff(VariousDefOf.Hediff_Estrus)) return; } else { - Hediff concealedHediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Estrus_Concealed); - if (concealedHediff != null) parent.pawn.health.RemoveHediff(concealedHediff); + Hediff concealedHediff = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Estrus_Concealed); + if (concealedHediff != null) Pawn.health.RemoveHediff(concealedHediff); } if (hediff != null) @@ -1111,9 +1110,9 @@ namespace RJW_Menstruation } else { - hediff = HediffMaker.MakeHediff(estrusdef, parent.pawn); + hediff = HediffMaker.MakeHediff(estrusdef, Pawn); hediff.Severity = (float)days / Configurations.CycleAcceleration + 0.2f; - parent.pawn.health.AddHediff(hediff); + Pawn.health.AddHediff(hediff); } } @@ -1121,7 +1120,7 @@ namespace RJW_Menstruation { if (Props.breedingSeason == SeasonalBreed.Always) return true; - int tile = parent.pawn.Tile; + int tile = Pawn.Tile; if (tile < 0) tile = Find.AnyPlayerHomeMap?.Tile ?? -1; if (tile < 0) return true; switch (GenLocalDate.Season(tile)) @@ -1144,7 +1143,7 @@ namespace RJW_Menstruation protected Pawn Fertilize() { if (cums.NullOrEmpty()) return null; - List eligibleCum = cums.FindAll(cum => !cum.notcum && cum.FertVolume > 0 && cum.pawn != null && (RJWPregnancySettings.bestial_pregnancy_enabled || xxx.is_animal(parent.pawn) == xxx.is_animal(cum.pawn))); + List eligibleCum = cums.FindAll(cum => !cum.notcum && cum.FertVolume > 0 && cum.pawn != null && (RJWPregnancySettings.bestial_pregnancy_enabled || xxx.is_animal(Pawn) == xxx.is_animal(cum.pawn))); if (eligibleCum.Count == 0) return null; float totalFertPower = eligibleCum.Sum(cum => cum.FertVolume); @@ -1152,7 +1151,7 @@ namespace RJW_Menstruation if (Rand.Range(0.0f, 1.0f) > 1.0f - Mathf.Pow(1.0f - Configurations.FertilizeChance, totalFertPower * Props.basefertilizationChanceFactor)) return null; - parent.pawn.records.AddTo(VariousDefOf.AmountofFertilizedEggs, 1); + Pawn.records.AddTo(VariousDefOf.AmountofFertilizedEggs, 1); float selection = Rand.Range(0.0f, totalFertPower); foreach (Cum cum in eligibleCum) @@ -1183,7 +1182,7 @@ namespace RJW_Menstruation deadeggs.Add(egg); continue; } - else if (parent.pawn.health.hediffSet.GetHediffs().Any() || pregnancy is Hediff_MechanoidPregnancy) + else if (Pawn.health.hediffSet.GetHediffs().Any() || pregnancy is Hediff_MechanoidPregnancy) { deadeggs.Add(egg); continue; @@ -1196,7 +1195,7 @@ namespace RJW_Menstruation { if (pregnancy is Hediff_MultiplePregnancy h) { - h.AddNewBaby(parent.pawn, egg.fertilizer); + h.AddNewBaby(Pawn, egg.fertilizer); } pregnant = true; deadeggs.Add(egg); @@ -1211,15 +1210,15 @@ namespace RJW_Menstruation { if (!Configurations.UseMultiplePregnancy) { - PregnancyHelper.PregnancyDecider(parent.pawn, egg.fertilizer); + PregnancyHelper.PregnancyDecider(Pawn, egg.fertilizer); // I hate having to do this, but it gets the newest pregnancy - pregnancy = parent.pawn.health.hediffSet.GetHediffs().MaxBy(hediff => hediff.loadID); + pregnancy = Pawn.health.hediffSet.GetHediffs().MaxBy(hediff => hediff.loadID); pregnant = true; break; } else { - pregnancy = Hediff_BasePregnancy.Create(parent.pawn, egg.fertilizer); + pregnancy = Hediff_BasePregnancy.Create(Pawn, egg.fertilizer); pregnant = true; deadeggs.Add(egg); } @@ -1248,7 +1247,7 @@ namespace RJW_Menstruation protected void BleedOut() { - CumIn(parent.pawn, Rand.Range(0.02f * Configurations.BleedingAmount, 0.04f * Configurations.BleedingAmount), Translations.Menstrual_Blood, -5.0f, parent.pawn.def.race?.BloodDef ?? ThingDefOf.Filth_Blood); + CumIn(Pawn, Rand.Range(0.02f * Configurations.BleedingAmount, 0.04f * Configurations.BleedingAmount), Translations.Menstrual_Blood, -5.0f, Pawn.def.race?.BloodDef ?? ThingDefOf.Filth_Blood); Cum blood = GetNotCum(Translations.Menstrual_Blood); if (blood != null) blood.Color = BloodColor; } @@ -1260,8 +1259,8 @@ namespace RJW_Menstruation /// protected void MakeCumFilth(Cum cum, float amount) { - if (parent.pawn.Map == null) return; - if (amount >= minmakefilthvalue) FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, cum.FilthDef, cum.pawn?.LabelShort ?? "Unknown"); + if (Pawn.Map == null) return; + if (amount >= minmakefilthvalue) FilthMaker.TryMakeFilth(Pawn.Position, Pawn.Map, cum.FilthDef, cum.pawn?.LabelShort ?? "Unknown"); } /// @@ -1276,7 +1275,7 @@ namespace RJW_Menstruation if (absorber == null) { - //if (amount >= minmakefilthvalue) FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, cum.FilthDef, cum.pawn.LabelShort); + //if (amount >= minmakefilthvalue) FilthMaker.TryMakeFilth(Pawn.Position, Pawn.Map, cum.FilthDef, cum.pawn.LabelShort); return amount; } @@ -1284,11 +1283,11 @@ namespace RJW_Menstruation absorber.SetColor(Colors.CMYKLerp(GetCumMixtureColor, absorber.DrawColor, 1f - amount / absorbable)); if (absorber.dirty) { - //if (absorber.LeakAfterDirty) FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, cum.FilthDef, cum.pawn.LabelShort); + //if (absorber.LeakAfterDirty) FilthMaker.TryMakeFilth(Pawn.Position, Pawn.Map, cum.FilthDef, cum.pawn.LabelShort); return amount; } absorber.absorbedfluids += amount; - if (absorber.absorbedfluids > absorbable && !parent.pawn.apparel.IsLocked(absorber)) + if (absorber.absorbedfluids > absorbable && !Pawn.apparel.IsLocked(absorber)) { absorber.def = absorber.DirtyDef; //absorber.fluidColor = GetCumMixtureColor; @@ -1299,10 +1298,10 @@ namespace RJW_Menstruation protected float MakeCumFilthMixture(float amount, List cumlabels) { - if (parent.pawn.Map == null) return 0; + if (Pawn.Map == null) return 0; if (amount >= minmakefilthvalue) { - FilthMaker_Colored.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, VariousDefOf.FilthMixture, cumlabels, GetCumMixtureColor, false); + FilthMaker_Colored.TryMakeFilth(Pawn.Position, Pawn.Map, VariousDefOf.FilthMixture, cumlabels, GetCumMixtureColor, false); } return amount; } @@ -1335,11 +1334,11 @@ namespace RJW_Menstruation protected void AddCrampPain() { - Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_MenstrualCramp, parent.pawn); + Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_MenstrualCramp, Pawn); hediff.Severity = crampPain * Rand.Range(0.9f, 1.1f); HediffCompProperties_SeverityPerDay Prop = (HediffCompProperties_SeverityPerDay)hediff.TryGetComp().props; Prop.severityPerDay = -hediff.Severity / (currentIntervalHours / 24) * Configurations.CycleAcceleration; - parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn)); + Pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(Pawn)); } protected virtual void FollicularAction(bool climacteric) @@ -1383,7 +1382,7 @@ namespace RJW_Menstruation float eggnum; try { - eggnum = Rand.ByCurve(parent.pawn.def.race.litterSizeCurve); + eggnum = Rand.ByCurve(Pawn.def.race.litterSizeCurve); } catch (NullReferenceException) { @@ -1391,7 +1390,7 @@ namespace RJW_Menstruation } catch (ArgumentException e) { - Log.Warning($"Invalid litterSizeCurve for {parent.pawn.def}: {e}"); + Log.Warning($"Invalid litterSizeCurve for {Pawn.def}: {e}"); eggnum = 1; } eggnum += eggstack; @@ -1406,19 +1405,19 @@ namespace RJW_Menstruation if (Configurations.EnableMenopause && ovarypower < 1) { eggs.Clear(); - Hediff hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Climacteric); - if (hediff != null) parent.pawn.health.RemoveHediff(hediff); - hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn); + Hediff hediff = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Climacteric); + if (hediff != null) Pawn.health.RemoveHediff(hediff); + hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, Pawn); hediff.Severity = 0.2f; - parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn)); + Pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(Pawn)); ovarypower = 0; GoNextStage(Stage.Young); } else if (Configurations.EnableMenopause && ovarypower < OvaryPowerThreshold) { - Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Climacteric, parent.pawn); + Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Climacteric, Pawn); hediff.Severity = Mathf.InverseLerp(OvaryPowerThreshold, 0, ovarypower); - parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn)); + Pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(Pawn)); GoNextStage(Stage.ClimactericLuteal); } else @@ -1485,8 +1484,8 @@ namespace RJW_Menstruation } else if (curStageHrs >= currentIntervalHours) { - Hediff hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_MenstrualCramp); - if (hediff != null) parent.pawn.health.RemoveHediff(hediff); + Hediff hediff = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_MenstrualCramp); + if (hediff != null) Pawn.health.RemoveHediff(hediff); int totalFollicularHours = PeriodRandomizer(climacteric ? Stage.ClimactericFollicular : Stage.Follicular, climacteric ? 6.0f : 1.0f); // The total amount of time for both bleeding and follicular if (totalFollicularHours <= currentIntervalHours) // We've bled for so long that we completely missed the follicular phase GoOvulatoryStage(climacteric); @@ -1513,7 +1512,7 @@ namespace RJW_Menstruation Implant(); } - if (parent.pawn.health.hediffSet.hediffs.Contains(pregnancy)) + if (Pawn.health.hediffSet.hediffs.Contains(pregnancy)) { curStageHrs += 1; StayCurrentStageConst(Stage.Pregnant); @@ -1533,7 +1532,7 @@ namespace RJW_Menstruation { GoNextStage(Stage.ClimactericFollicular); } - else if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) == 0) + else if (Pawn.health.capacities.GetLevel(xxx.reproduction) == 0) { GoNextStage(Stage.Young); } @@ -1555,7 +1554,7 @@ namespace RJW_Menstruation { RemoveClimactericEffect(); } - if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) + if (Pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) { StayCurrentStageConst(Stage.Young); } @@ -1580,54 +1579,54 @@ namespace RJW_Menstruation protected virtual void ThoughtCumInside(Pawn cummer) { - if (!xxx.is_human(parent.pawn) || !xxx.is_human(cummer)) return; + if (!xxx.is_human(Pawn) || !xxx.is_human(cummer)) return; - if ((cummer.Has(Quirk.Teratophile) != (parent.pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)) || + if ((cummer.Has(Quirk.Teratophile) != (Pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)) || cummer.Has(Quirk.ImpregnationFetish) || cummer.Has(Quirk.Breeder)) { - if (cummer.relations.OpinionOf(parent.pawn) <= -25) + if (cummer.relations.OpinionOf(Pawn) <= -25) { - cummer.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideM, parent.pawn); + cummer.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideM, Pawn); } else { - cummer.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideM, parent.pawn); + cummer.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideM, Pawn); } } if (IsDangerDay) { - if (parent.pawn.Has(Quirk.Breeder) || parent.pawn.Has(Quirk.ImpregnationFetish)) + if (Pawn.Has(Quirk.Breeder) || Pawn.Has(Quirk.ImpregnationFetish)) { - parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetish, cummer); + Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetish, cummer); } - else if (parent.pawn.relations.OpinionOf(cummer) <= -5) + else if (Pawn.relations.OpinionOf(cummer) <= -5) { - parent.pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.CameInsideF, cummer); - parent.pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.HaterCameInsideFEstrus, cummer); - parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideF, cummer); + Pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.CameInsideF, cummer); + Pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.HaterCameInsideFEstrus, cummer); + Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideF, cummer); } - else if (parent.pawn.IsInEstrus() && parent.pawn.relations.OpinionOf(cummer) < RJWHookupSettings.MinimumRelationshipToHookup) + else if (Pawn.IsInEstrus() && Pawn.relations.OpinionOf(cummer) < RJWHookupSettings.MinimumRelationshipToHookup) { - parent.pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.CameInsideF, cummer); - parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideFEstrus, cummer); + Pawn.needs.mood.thoughts.memories.RemoveMemoriesOfDefWhereOtherPawnIs(VariousDefOf.CameInsideF, cummer); + Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideFEstrus, cummer); } - else if (!parent.pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, cummer) && !parent.pawn.relations.DirectRelationExists(PawnRelationDefOf.Fiance, cummer)) + else if (!Pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, cummer) && !Pawn.relations.DirectRelationExists(PawnRelationDefOf.Fiance, cummer)) { - if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) < 0.50f) parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFLowFert, cummer); - else parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideF, cummer); + if (Pawn.health.capacities.GetLevel(xxx.reproduction) < 0.50f) Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFLowFert, cummer); + else Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideF, cummer); } } else { - if (parent.pawn.Has(Quirk.Breeder) || parent.pawn.Has(Quirk.ImpregnationFetish)) + if (Pawn.Has(Quirk.Breeder) || Pawn.Has(Quirk.ImpregnationFetish)) { - parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetishSafe, cummer); + Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetishSafe, cummer); } - else if (parent.pawn.relations.OpinionOf(cummer) <= -5) + else if (Pawn.relations.OpinionOf(cummer) <= -5) { - parent.pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideFSafe, cummer); + Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.HaterCameInsideFSafe, cummer); } } } @@ -1635,11 +1634,11 @@ namespace RJW_Menstruation protected virtual void TaleCumInside(Pawn cummer) { // Only make the tale for human-on-human, consentual sex. Otherwise the art just gets too hard to phrase properly - if (!xxx.is_human(parent.pawn) || !xxx.is_human(cummer) || parent.pawn == cummer) return; - if (parent.pawn.CurJobDef != xxx.casual_sex && parent.pawn.CurJobDef != xxx.gettin_loved) return; - if (!(parent.pawn.IsColonist || parent.pawn.IsPrisonerOfColony) && !(cummer.IsColonist || cummer.IsPrisonerOfColony)) return; + if (!xxx.is_human(Pawn) || !xxx.is_human(cummer) || Pawn == cummer) return; + if (Pawn.CurJobDef != xxx.casual_sex && Pawn.CurJobDef != xxx.gettin_loved) return; + if (!(Pawn.IsColonist || Pawn.IsPrisonerOfColony) && !(cummer.IsColonist || cummer.IsPrisonerOfColony)) return; if (!IsDangerDay) return; - TaleRecorder.RecordTale(VariousDefOf.TaleCameInside, new object[] { cummer, parent.pawn }); + TaleRecorder.RecordTale(VariousDefOf.TaleCameInside, new object[] { cummer, Pawn }); } protected void GoNextStage(Stage nextstage, bool calculateHours = true) @@ -1680,10 +1679,10 @@ namespace RJW_Menstruation protected void RemoveClimactericEffect() { - Hediff hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Climacteric); - if (hediff != null) parent.pawn.health.RemoveHediff(hediff); - hediff = parent.pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Menopause); - if (hediff != null) parent.pawn.health.RemoveHediff(hediff); + Hediff hediff = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Climacteric); + if (hediff != null) Pawn.health.RemoveHediff(hediff); + hediff = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_Menopause); + if (hediff != null) Pawn.health.RemoveHediff(hediff); if (curStage == Stage.ClimactericBleeding) curStage = Stage.Bleeding; else if (curStage == Stage.ClimactericFollicular) curStage = Stage.Follicular; else if (curStage == Stage.ClimactericLuteal) curStage = Stage.Luteal; @@ -1714,10 +1713,10 @@ namespace RJW_Menstruation protected float InterspeciesImplantFactor(Pawn fertilizer) { - if (fertilizer.def.defName == parent.pawn.def.defName) return 1.0f; + if (fertilizer.def.defName == Pawn.def.defName) return 1.0f; else { - if (RJWPregnancySettings.complex_interspecies) return SexUtility.BodySimilarity(parent.pawn, fertilizer); + if (RJWPregnancySettings.complex_interspecies) return SexUtility.BodySimilarity(Pawn, fertilizer); else return RJWPregnancySettings.interspecies_impregnation_modifier; } }