diff --git a/1.3/Assemblies/RJW_Menstruation.dll b/1.3/Assemblies/RJW_Menstruation.dll index 189a970..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/Defs/TaleDefs/Tales_Cum.xml b/1.3/Defs/TaleDefs/Tales_Cum.xml index b5a37c7..105f2b2 100644 --- a/1.3/Defs/TaleDefs/Tales_Cum.xml +++ b/1.3/Defs/TaleDefs/Tales_Cum.xml @@ -1,3 +1,4 @@ + CameInside diff --git a/1.3/Patches/Drugs.xml b/1.3/Patches/Drugs.xml index f601a1c..6f53daf 100644 --- a/1.3/Patches/Drugs.xml +++ b/1.3/Patches/Drugs.xml @@ -2,14 +2,14 @@ - Defs/ThingDef[defName="RJW_FertPill"]/ingestible/outcomeDoers + /Defs/ThingDef[defName="RJW_FertPill"]/ingestible/outcomeDoers
  • - Defs/ThingDef[defName="RJW_Contraceptive"]/ingestible/outcomeDoers + /Defs/ThingDef[defName="RJW_Contraceptive"]/ingestible/outcomeDoers
  • diff --git a/1.3/Patches/Hediffs_PrivateParts.xml b/1.3/Patches/Hediffs_PrivateParts.xml index 662def7..b68a104 100644 --- a/1.3/Patches/Hediffs_PrivateParts.xml +++ b/1.3/Patches/Hediffs_PrivateParts.xml @@ -9,7 +9,7 @@ - Defs/rjw.HediffDef_PartBase[defName="Vagina"] + /Defs/rjw.HediffDef_PartBase[defName="Vagina"]
  • @@ -31,7 +31,7 @@ - Defs/rjw.HediffDef_PartBase[defName="GenericVagina"] + /Defs/rjw.HediffDef_PartBase[defName="GenericVagina"]
  • @@ -51,7 +51,7 @@ - Defs/rjw.HediffDef_PartBase[defName="HydraulicVagina"] + /Defs/rjw.HediffDef_PartBase[defName="HydraulicVagina"]
  • @@ -65,7 +65,7 @@ - Defs/rjw.HediffDef_PartBase[defName="BionicVagina"] + /Defs/rjw.HediffDef_PartBase[defName="BionicVagina"]
  • @@ -79,7 +79,7 @@ - Defs/rjw.HediffDef_PartBase[defName="ArchotechVagina"] + /Defs/rjw.HediffDef_PartBase[defName="ArchotechVagina"]
  • @@ -100,7 +100,7 @@ - Defs/rjw.HediffDef_PartBase[defName="Anus"] + /Defs/rjw.HediffDef_PartBase[defName="Anus"]
  • @@ -111,7 +111,7 @@ - Defs/rjw.HediffDef_PartBase[defName="HydraulicAnus"] + /Defs/rjw.HediffDef_PartBase[defName="HydraulicAnus"]
  • @@ -122,7 +122,7 @@ - Defs/rjw.HediffDef_PartBase[defName="BionicAnus"] + /Defs/rjw.HediffDef_PartBase[defName="BionicAnus"]
  • @@ -133,7 +133,7 @@ - Defs/rjw.HediffDef_PartBase[defName="ArchotechAnus"] + /Defs/rjw.HediffDef_PartBase[defName="ArchotechAnus"]
  • diff --git a/1.3/Patches/Hediffs_PrivateParts_Animal.xml b/1.3/Patches/Hediffs_PrivateParts_Animal.xml index 8ffacb0..723eafc 100644 --- a/1.3/Patches/Hediffs_PrivateParts_Animal.xml +++ b/1.3/Patches/Hediffs_PrivateParts_Animal.xml @@ -11,7 +11,7 @@ - Defs/rjw.HediffDef_PartBase[defName="DogVagina"] + /Defs/rjw.HediffDef_PartBase[defName="DogVagina"]
  • @@ -32,7 +32,7 @@ - Defs/rjw.HediffDef_PartBase[defName="CatVagina"] + /Defs/rjw.HediffDef_PartBase[defName="CatVagina"]
  • @@ -54,7 +54,7 @@ - Defs/rjw.HediffDef_PartBase[defName="HorseVagina"] + /Defs/rjw.HediffDef_PartBase[defName="HorseVagina"]
  • @@ -77,7 +77,7 @@ - Defs/rjw.HediffDef_PartBase[defName="DragonVagina"] + /Defs/rjw.HediffDef_PartBase[defName="DragonVagina"]
  • @@ -98,7 +98,7 @@ - Defs/rjw.HediffDef_PartBase[defName="NarrowVagina"] + /Defs/rjw.HediffDef_PartBase[defName="NarrowVagina"]
  • @@ -119,7 +119,7 @@ - Defs/rjw.HediffDef_PartBase[defName="RodentVagina"] + /Defs/rjw.HediffDef_PartBase[defName="RodentVagina"]
  • @@ -140,7 +140,7 @@ - Defs/rjw.HediffDef_PartBase[defName="SlimeVagina"] + /Defs/rjw.HediffDef_PartBase[defName="SlimeVagina"]
  • @@ -161,7 +161,7 @@ - Defs/rjw.HediffDef_PartBase[defName="DemonVagina"] + /Defs/rjw.HediffDef_PartBase[defName="DemonVagina"]
  • diff --git a/1.3/Patches/Hediffs_PrivateParts_Breasts.xml b/1.3/Patches/Hediffs_PrivateParts_Breasts.xml index b3b514b..fff7a18 100644 --- a/1.3/Patches/Hediffs_PrivateParts_Breasts.xml +++ b/1.3/Patches/Hediffs_PrivateParts_Breasts.xml @@ -3,7 +3,7 @@ - Defs/rjw.HediffDef_PartBase[defName="Breasts"] + /Defs/rjw.HediffDef_PartBase[defName="Breasts"]
  • @@ -15,7 +15,7 @@ - Defs/rjw.HediffDef_PartBase[defName="HydraulicBreasts"] + /Defs/rjw.HediffDef_PartBase[defName="HydraulicBreasts"]
  • @@ -27,7 +27,7 @@ - Defs/rjw.HediffDef_PartBase[defName="BionicBreasts"] + /Defs/rjw.HediffDef_PartBase[defName="BionicBreasts"]
  • @@ -39,7 +39,7 @@ - Defs/rjw.HediffDef_PartBase[defName="ArchotechBreasts"] + /Defs/rjw.HediffDef_PartBase[defName="ArchotechBreasts"]
  • @@ -51,7 +51,7 @@ - Defs/rjw.HediffDef_PartBase[defName="SlimeBreasts"] + /Defs/rjw.HediffDef_PartBase[defName="SlimeBreasts"]
  • diff --git a/1.3/Patches/Item_Resource_Stuffs.xml b/1.3/Patches/Item_Resource_Stuffs.xml index 9a4a571..2bdc062 100644 --- a/1.3/Patches/Item_Resource_Stuffs.xml +++ b/1.3/Patches/Item_Resource_Stuffs.xml @@ -2,35 +2,35 @@ - Defs/ThingDef[defName="Cloth"]/stuffProps/statFactors + /Defs/ThingDef[defName="Cloth"]/stuffProps/statFactors 1.0 - Defs/ThingDef[defName="Synthread"]/stuffProps/statFactors + /Defs/ThingDef[defName="Synthread"]/stuffProps/statFactors 2.0 - Defs/ThingDef[defName="DevilstrandCloth"]/stuffProps/statFactors + /Defs/ThingDef[defName="DevilstrandCloth"]/stuffProps/statFactors 0.5 - Defs/ThingDef[defName="Hyperweave"]/stuffProps/statFactors + /Defs/ThingDef[defName="Hyperweave"]/stuffProps/statFactors 0.25 - Defs/ThingDef[@Name="WoolBase"]/stuffProps/statFactors + /Defs/ThingDef[@Name="WoolBase"]/stuffProps/statFactors 1.5 diff --git a/1.3/Patches/PawnModExtensions.xml b/1.3/Patches/PawnModExtensions.xml index eb7ce03..4daadde 100644 --- a/1.3/Patches/PawnModExtensions.xml +++ b/1.3/Patches/PawnModExtensions.xml @@ -34,7 +34,7 @@ - Defs/ThingDef[defName="Human"] + /Defs/ThingDef[defName="Human"]
  • Fetus/Fetus_Default diff --git a/1.3/Patches/PawnModExtensions_Animals.xml b/1.3/Patches/PawnModExtensions_Animals.xml index 0a7547b..9c69aa8 100644 --- a/1.3/Patches/PawnModExtensions_Animals.xml +++ b/1.3/Patches/PawnModExtensions_Animals.xml @@ -27,7 +27,7 @@ - Defs/ThingDef[@Name="BigBirdThingBase"] + /Defs/ThingDef[@Name="BigBirdThingBase"]
  • Fetus/Birds/Fetus_Bird @@ -40,7 +40,7 @@ - Defs/ThingDef[defName="Chicken"] + /Defs/ThingDef[defName="Chicken"]
  • Fetus/Birds/Fetus_Bird @@ -53,7 +53,7 @@ - Defs/ThingDef[defName="Duck"] + /Defs/ThingDef[defName="Duck"]
  • Fetus/Birds/Fetus_Bird @@ -66,7 +66,7 @@ - Defs/ThingDef[defName="Goose"] + /Defs/ThingDef[defName="Goose"]
  • Fetus/Birds/Fetus_Bird @@ -79,7 +79,7 @@ - Defs/ThingDef[defName="YorkshireTerrier"] + /Defs/ThingDef[defName="YorkshireTerrier"]
  • Fetus/Canines/Fetus_Dog @@ -93,7 +93,7 @@ - Defs/ThingDef[defName="Husky"] + /Defs/ThingDef[defName="Husky"]
  • Fetus/Canines/Fetus_Dog @@ -106,7 +106,7 @@ - Defs/ThingDef[defName="LabradorRetriever"] + /Defs/ThingDef[defName="LabradorRetriever"]
  • Fetus/Canines/Fetus_Dog @@ -119,7 +119,7 @@ - Defs/ThingDef[defName="YorkshireTerrier"] + /Defs/ThingDef[defName="YorkshireTerrier"]
  • Fetus/Canines/Fetus_Dog @@ -133,7 +133,7 @@ - Defs/ThingDef[defName="Warg"] + /Defs/ThingDef[defName="Warg"]
  • Fetus/Canines/Fetus_Dog @@ -146,7 +146,7 @@ - Defs/ThingDef[@Name="ThingBaseWolf"] + /Defs/ThingDef[@Name="ThingBaseWolf"]
  • Fetus/Canines/Fetus_Dog @@ -159,7 +159,7 @@ - Defs/ThingDef[@Name="ThingBaseFox"] + /Defs/ThingDef[@Name="ThingBaseFox"]
  • Fetus/Canines/Fetus_Dog @@ -172,7 +172,7 @@ - Defs/ThingDef[defName="Pig"] + /Defs/ThingDef[defName="Pig"]
  • Fetus/Livestocks/Fetus_Pig @@ -185,7 +185,7 @@ - Defs/ThingDef[defName="WildBoar"] + /Defs/ThingDef[defName="WildBoar"]
  • Fetus/Livestocks/Fetus_Pig @@ -198,7 +198,7 @@ - Defs/ThingDef[@Name="BaseInsect"] + /Defs/ThingDef[@Name="BaseInsect"]
  • Fetus/Insects/Fetus_Insect diff --git a/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Animal_RaceSupport.xml b/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Animal_RaceSupport.xml index 556660e..e2a3d47 100644 --- a/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Animal_RaceSupport.xml +++ b/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Animal_RaceSupport.xml @@ -11,7 +11,7 @@ - Defs/rjw.HediffDef_PartBase[defName="CervineVagina"] + /Defs/rjw.HediffDef_PartBase[defName="CervineVagina"]
  • @@ -32,7 +32,7 @@ - Defs/rjw.HediffDef_PartBase[defName="CactoidVagina"] + /Defs/rjw.HediffDef_PartBase[defName="CactoidVagina"]
  • @@ -53,7 +53,7 @@ - Defs/rjw.HediffDef_PartBase[defName="TreeVagina"] + /Defs/rjw.HediffDef_PartBase[defName="TreeVagina"]
  • @@ -74,7 +74,7 @@ - Defs/rjw.HediffDef_PartBase[defName="PistilVagina"] + /Defs/rjw.HediffDef_PartBase[defName="PistilVagina"]
  • @@ -95,7 +95,7 @@ - Defs/rjw.HediffDef_PartBase[defName="NephilaSlimeVagina"] + /Defs/rjw.HediffDef_PartBase[defName="NephilaSlimeVagina"]
  • @@ -116,7 +116,7 @@ - Defs/rjw.HediffDef_PartBase[defName="GhostVagina"] + /Defs/rjw.HediffDef_PartBase[defName="GhostVagina"]
  • @@ -137,7 +137,7 @@ - Defs/rjw.HediffDef_PartBase[defName="NecroVagina"] + /Defs/rjw.HediffDef_PartBase[defName="NecroVagina"]
  • diff --git a/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Breasts_RaceSupport.xml b/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Breasts_RaceSupport.xml index f4b4c61..cd1f6cc 100644 --- a/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Breasts_RaceSupport.xml +++ b/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Breasts_RaceSupport.xml @@ -4,7 +4,7 @@ - Defs/rjw.HediffDef_PartBase[defName="BigRaceBreats"] + /Defs/rjw.HediffDef_PartBase[defName="BigRaceBreats"]
  • @@ -16,7 +16,7 @@ - Defs/rjw.HediffDef_PartBase[defName="OrcBreasts"] + /Defs/rjw.HediffDef_PartBase[defName="OrcBreasts"]
  • @@ -28,7 +28,7 @@ - Defs/rjw.HediffDef_PartBase[defName="GhoulBreasts"] + /Defs/rjw.HediffDef_PartBase[defName="GhoulBreasts"]
  • @@ -40,7 +40,7 @@ - Defs/rjw.HediffDef_PartBase[defName="GhostBreasts"] + /Defs/rjw.HediffDef_PartBase[defName="GhostBreasts"]
  • @@ -52,7 +52,7 @@ - Defs/rjw.HediffDef_PartBase[defName="NecroBreasts"] + /Defs/rjw.HediffDef_PartBase[defName="NecroBreasts"]
  • @@ -64,7 +64,7 @@ - Defs/rjw.HediffDef_PartBase[defName="NephilaBreasts"] + /Defs/rjw.HediffDef_PartBase[defName="NephilaBreasts"]
  • @@ -76,7 +76,7 @@ - Defs/rjw.HediffDef_PartBase[defName="NephilaSlimeBreasts"] + /Defs/rjw.HediffDef_PartBase[defName="NephilaSlimeBreasts"]
  • @@ -88,7 +88,7 @@ - Defs/rjw.HediffDef_PartBase[defName="UdderBreasts"] + /Defs/rjw.HediffDef_PartBase[defName="UdderBreasts"]
  • diff --git a/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Humanlike_RaceSupport.xml b/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Humanlike_RaceSupport.xml index e0d0729..2629d3b 100644 --- a/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Humanlike_RaceSupport.xml +++ b/1.3/RJW Menstruation Race Support/Patches/Hediffs_PrivateParts_Humanlike_RaceSupport.xml @@ -9,7 +9,7 @@ - Defs/rjw.HediffDef_PartBase[defName="ElfVagina"] + /Defs/rjw.HediffDef_PartBase[defName="ElfVagina"]
  • @@ -30,7 +30,7 @@ - Defs/rjw.HediffDef_PartBase[defName="ElfAnus"] + /Defs/rjw.HediffDef_PartBase[defName="ElfAnus"]
  • @@ -41,7 +41,7 @@ - Defs/rjw.HediffDef_PartBase[defName="OrcVagina"] + /Defs/rjw.HediffDef_PartBase[defName="OrcVagina"]
  • @@ -62,7 +62,7 @@ - Defs/rjw.HediffDef_PartBase[defName="OrcAnus"] + /Defs/rjw.HediffDef_PartBase[defName="OrcAnus"]
  • @@ -75,7 +75,7 @@ - Defs/rjw.HediffDef_PartBase[defName="GhoulVagina"] + /Defs/rjw.HediffDef_PartBase[defName="GhoulVagina"]
  • @@ -96,7 +96,7 @@ - Defs/rjw.HediffDef_PartBase[defName="GhoulAnus"] + /Defs/rjw.HediffDef_PartBase[defName="GhoulAnus"]
  • 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/HARCompatibility.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/HARCompatibility.cs index 863eaa4..84d1f62 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/HARCompatibility.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/HARCompatibility.cs @@ -14,15 +14,10 @@ namespace RJW_Menstruation return pawn?.def is ThingDef_AlienRace; } - public static AlienPartGenerator.AlienComp GetHARComp(this Pawn pawn) - { - return pawn?.TryGetComp(); - } - public static void CopyHARProperties(Pawn baby, Pawn original) { - AlienPartGenerator.AlienComp babyHARComp = baby.GetHARComp(); - AlienPartGenerator.AlienComp originalHARComp = original.GetHARComp(); + AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp(); + AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp(); if (babyHARComp == null || originalHARComp == null) return; babyHARComp.crownType = originalHARComp.crownType; @@ -37,8 +32,8 @@ namespace RJW_Menstruation // 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.GetHARComp(); - AlienPartGenerator.AlienComp originalHARComp = original.GetHARComp(); + AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp(); + AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp(); 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(originalHARComp.addonVariants); 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 a275479..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,9 +165,8 @@ namespace RJW_Menstruation try { if ( - !parent.pawn.IsHashIntervalTick(tickInterval) || - !parent.pawn.Spawned || // TODO: Add option to simulate off-map pawns - parent.pawn.health.Dead + !Pawn.IsHashIntervalTick(tickInterval) || + !Pawn.Spawned // TODO: Add option to simulate off-map pawns ) { return; @@ -178,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}"); } } @@ -186,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(); @@ -202,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; @@ -255,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) @@ -265,9 +264,9 @@ namespace RJW_Menstruation } } // Scenario B: Pregnant, grow in the second half of first trimester - else if (parent.pawn.IsPregnant()) + 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"; @@ -299,13 +298,15 @@ 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.IsPregnant()) - newNippleProgress = nippleTransitions.Evaluate(parent.pawn.GetFarthestPregnancyProgress()); + else if (Pawn.IsRJWPregnant()) + newNippleProgress = nippleTransitions.Evaluate(Pawn.GetFarthestPregnancyProgress()); else newNippleProgress = 0f; + if (newNippleProgress < 0) newNippleProgress = 0; + if (newNippleProgress == nippleProgress) return; // Nothing to change else if (newNippleProgress > nippleProgress) { @@ -352,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 fc07cb6..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 @@ -1,4 +1,5 @@ using RimWorld; +using RimWorld.Planet; using rjw; using System; using System.Collections.Generic; @@ -123,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; @@ -142,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 { @@ -152,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; } } @@ -185,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; } @@ -195,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; } @@ -206,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 @@ -419,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) { @@ -450,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 @@ -466,7 +467,7 @@ namespace RJW_Menstruation { if (breastcache == null) { - breastcache = parent.pawn.GetBreastComp(); + breastcache = Pawn.GetBreastComp(); } return breastcache; } @@ -505,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)); @@ -558,17 +559,16 @@ namespace RJW_Menstruation try { if ( - !parent.pawn.IsHashIntervalTick(tickInterval) || - !parent.pawn.Spawned || // TODO: Add option to simulate off-map pawns - parent.pawn.health.Dead || - (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,12 +622,13 @@ 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; } - pregnancy?.Miscarry(); + if (!(pregnancy is Hediff_MechanoidPregnancy)) + pregnancy.Miscarry(); base.CompPostPostRemoved(); } @@ -666,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) @@ -700,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); } @@ -776,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(); @@ -795,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); } /// @@ -821,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 == rjw.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); @@ -912,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); } /// @@ -958,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) @@ -978,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) { @@ -990,7 +991,7 @@ namespace RJW_Menstruation } } - //Log.Message(parent.pawn.Label + " - Initialized menstruation comp"); + //Log.Message(Pawn.Label + " - Initialized menstruation comp"); loaded = true; } @@ -1016,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(); @@ -1036,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); @@ -1053,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)); } } } @@ -1081,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; @@ -1092,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) @@ -1110,19 +1110,20 @@ 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); } } public bool IsBreedingSeason() { if (Props.breedingSeason == SeasonalBreed.Always) return true; - Map map = parent.pawn.Map; - if (map == null) map = Find.AnyPlayerHomeMap; - if (map == null) return true; - switch (GenLocalDate.Season(map)) + + int tile = Pawn.Tile; + if (tile < 0) tile = Find.AnyPlayerHomeMap?.Tile ?? -1; + if (tile < 0) return true; + switch (GenLocalDate.Season(tile)) { case Season.Spring: return (Props.breedingSeason & SeasonalBreed.Spring) != 0; @@ -1142,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); @@ -1150,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) @@ -1181,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; @@ -1194,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); @@ -1209,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); } @@ -1246,8 +1247,7 @@ namespace RJW_Menstruation protected void BleedOut() { - //FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, ThingDefOf.Filth_Blood,parent.pawn.Label); - 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; } @@ -1259,7 +1259,8 @@ namespace RJW_Menstruation /// protected void MakeCumFilth(Cum cum, float amount) { - 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"); } /// @@ -1274,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; } @@ -1282,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; @@ -1297,10 +1298,10 @@ namespace RJW_Menstruation protected float MakeCumFilthMixture(float amount, List cumlabels) { - + 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; } @@ -1333,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) @@ -1381,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) { @@ -1389,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; @@ -1404,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 @@ -1483,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); @@ -1511,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); @@ -1531,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); } @@ -1553,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); } @@ -1578,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); } } } @@ -1633,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) @@ -1678,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; @@ -1712,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; } } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs index 2c8c2c9..4c89ac0 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs @@ -51,7 +51,7 @@ namespace RJW_Menstruation "eggs: " + comp.GetNumofEggs + "\n"; } else description += comp.GetCurStageLabel + "\n"; - if (pawn.IsPregnant()) + if (pawn.IsRJWPregnant()) { Hediff_BasePregnancy hediff = comp.Pregnancy; if (hediff != null && Utility.ShowFetusImage(hediff)) diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs index f4445f9..87d61d8 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs @@ -57,10 +57,9 @@ namespace RJW_Menstruation if (__state == null || __state.Pregnancy != null) return; // It was pregnant, but not anymore. This probably means the pregnancy was destroyed by e.g. a mech implant Pawn pawn = props.partner; - Hediff_BasePregnancy newestPregnancy = pawn.health.hediffSet.GetHediffs().MaxBy(hediff => hediff.loadID); - if (newestPregnancy == null) return; + Hediff_BasePregnancy newestPregnancy = pawn.health.hediffSet.GetHediffs().MaxByWithFallback(hediff => hediff.loadID); - if (pawn.GetMenstruationComps().Any(comp => comp.Pregnancy == newestPregnancy)) return; // One of the wombs did get it + if (newestPregnancy == null || pawn.GetMenstruationComps().Any(comp => comp.Pregnancy == newestPregnancy)) return; // One of the wombs did get it else __state.Pregnancy = newestPregnancy; } diff --git a/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index 5e4ab93..6b83677 100644 --- a/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.3/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -135,15 +135,19 @@ namespace RJW_Menstruation else return false; } + public static bool IsRJWPregnant(this Pawn pawn) + { + return pawn.health.hediffSet.GetHediffs().Any(); + } public static float GetFarthestPregnancyProgress(this Pawn pawn) { - return pawn.health.hediffSet.GetHediffs().MaxBy(hediff => hediff.GestationProgress)?.GestationProgress ?? -1; + return pawn.health.hediffSet.GetHediffs().MaxByWithFallback(hediff => hediff.GestationProgress)?.GestationProgress ?? 0; } public static float GetPregnancyProgress(this HediffComp_Menstruation comp) { - if (comp.Pregnancy == null) return -1; + if (comp.Pregnancy == null) return 0; else return comp.Pregnancy.GestationProgress; } diff --git a/1.3/source/RJW_Menstruation/SexperienceModule/Patch/RJW_Patch.cs b/1.3/source/RJW_Menstruation/SexperienceModule/Patch/RJW_Patch.cs index b8ab565..8148fc5 100644 --- a/1.3/source/RJW_Menstruation/SexperienceModule/Patch/RJW_Patch.cs +++ b/1.3/source/RJW_Menstruation/SexperienceModule/Patch/RJW_Patch.cs @@ -14,7 +14,7 @@ namespace RJW_Menstruation.Sexperience [HarmonyPatch("HasJobOnThing")] public static bool HasJobOnThing(Pawn pawn, ref bool __result) { - if (pawn.GetMenstruationComps().Any(comp => comp.DoCleanWomb && comp.TotalCumPercent > 0.001f) && pawn.Map.listerBuildings.ColonistsHaveBuilding(VariousDefOf.CumBucket)) + if (pawn.GetMenstruationComps().Any(comp => comp.DoCleanWomb && comp.TotalCumPercent > 0.001f) && (pawn.Map?.listerBuildings.ColonistsHaveBuilding(VariousDefOf.CumBucket) ?? false)) { __result = true; return false; diff --git a/About/Manifest.xml b/About/Manifest.xml index 8984142..b40341b 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ RJW Menstruation - 1.0.7.1 + 1.0.7.2 diff --git a/changelogs.txt b/changelogs.txt index 9dbd28c..906ad74 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,3 +1,8 @@ +Version 1.0.7.2 + - Fix errors when trying to open dev actions when HAR is not installed + - Fix "error processing breasts" for pawns with vanilla pregnancy (e.g. animals) + - Removing a vagina won't end a mechanoid implant anymore. + Version 1.0.7.1 - Null reference error fix for multiple wombs when one is pregnant. - Fix the progress bar on pregnancy again. Also make undiscovered pregnancies a little more subtle.