diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index 8897ef0..2d0b679 100644 Binary files a/1.4/Assemblies/RJW_Menstruation.dll and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/Defs/GeneDefs/GeneDefs_Menstruation.xml b/1.4/Defs/GeneDefs/GeneDefs_Menstruation.xml index 0b788e7..9f20c9c 100644 --- a/1.4/Defs/GeneDefs/GeneDefs_Menstruation.xml +++ b/1.4/Defs/GeneDefs/GeneDefs_Menstruation.xml @@ -9,8 +9,7 @@ Menstruation - UI/Genes/Placeholder - +
  • Menstruation_EggLifetime
  • @@ -19,49 +18,33 @@ Menstruation_ShortEggLifetime Unfertilized eggs with this gene last three-quarters as long. - UI/Genes/ShortEggLifetime + UI/Genes/Placeholder 1 10 - -
  • - 0.75 -
  • -
    Menstruation_DoubleEggLifetime Unfertilized eggs with this gene last twice as long. - UI/Genes/DoubleEggLifetime + UI/Genes/Placeholder -1 12 - -
  • - 2.0 -
  • -
    Menstruation_QuadEggLifetime Eggs with this gene last four times as long. - UI/Genes/QuadEggLifetime + UI/Genes/Placeholder -2 1 16 - -
  • - 4.0 -
  • -
    Menstruation - UI/Genes/Placeholder - +
  • Menstruation_Estrus
  • @@ -70,35 +53,24 @@ Menstruation_NeverEstrus Carriers of this gene will never go into estrus. - UI/Genes/NeverEstrus + UI/Genes/Placeholder 1 20 - -
  • - true -
  • -
    Menstruation_FullEstrus Carriers of this gene will enter full estrus every menstrual cycle, regardless of vagina type. - UI/Genes/FullEstrus + UI/Genes/Placeholder -1 1 25 - -
  • - true -
  • -
    Menstruation - UI/Genes/Placeholder - +
  • Menstruation_Ovulation
  • @@ -107,28 +79,18 @@ Menstruation_DoubleOvulation Carriers of this gene will ovulate twice as many eggs. - UI/Genes/DoubleOvulation + UI/Genes/Placeholder -1 30 - -
  • - 2 -
  • -
    Menstruation_QuadOvulation Carriers of this gene will ovulate four times as many eggs. - UI/Genes/QuadOvulation + UI/Genes/Placeholder -1 35 - -
  • - 4 -
  • -
    @@ -136,14 +98,9 @@ Menstruation Carriers of this gene will not bleed at the end of their cycle. - UI/Genes/NoBleeding + UI/Genes/Placeholder -1 40 - -
  • - true -
  • -
    diff --git a/1.4/Patches/CycleDisabledGenes.xml b/1.4/Patches/CycleDisabledGenes.xml deleted file mode 100644 index 01f8827..0000000 --- a/1.4/Patches/CycleDisabledGenes.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - -
  • Alpha Genes
  • -
    - - /Defs/GeneDef[defName="AG_EggLaying"] - -
  • - true -
  • -
    -
    -
    - - - -
  • Vanilla Races Expanded - Saurid
  • -
    - - /Defs/GeneDef[defName="VRESaurids_Oviparous"] - -
  • - true -
  • -
    -
    -
    - - - -
  • Vanilla Races Expanded - Phytokin
  • -
    - - /Defs/GeneDef[defName="VRE_SaplingBirth"] - -
  • - true -
  • -
    -
    -
    - - - -
  • Erin's Corvyia
  • -
    - - /Defs/GeneDef[defName="ERN_EggLayer"] - -
  • - true -
  • -
    -
    -
    - - - -
  • Outland - Genetics
  • -
    - - /Defs/GeneDef[defName="Outland_EggLayer"] - -
  • - true -
  • -
    -
    -
    -
    \ No newline at end of file diff --git a/1.4/Patches/Hediffs_PrivateParts.xml b/1.4/Patches/Hediffs_PrivateParts.xml index 58bd529..6b6a570 100644 --- a/1.4/Patches/Hediffs_PrivateParts.xml +++ b/1.4/Patches/Hediffs_PrivateParts.xml @@ -144,5 +144,11 @@ - + + + + + + + \ No newline at end of file diff --git a/1.4/Textures/UI/Genes/DoubleEggLifetime.png b/1.4/Textures/UI/Genes/DoubleEggLifetime.png deleted file mode 100644 index a9c5935..0000000 Binary files a/1.4/Textures/UI/Genes/DoubleEggLifetime.png and /dev/null differ diff --git a/1.4/Textures/UI/Genes/DoubleOvulation.png b/1.4/Textures/UI/Genes/DoubleOvulation.png deleted file mode 100644 index 744e08a..0000000 Binary files a/1.4/Textures/UI/Genes/DoubleOvulation.png and /dev/null differ diff --git a/1.4/Textures/UI/Genes/Files.zip b/1.4/Textures/UI/Genes/Files.zip deleted file mode 100644 index b569056..0000000 Binary files a/1.4/Textures/UI/Genes/Files.zip and /dev/null differ diff --git a/1.4/Textures/UI/Genes/FullEstrus.png b/1.4/Textures/UI/Genes/FullEstrus.png deleted file mode 100644 index dec368b..0000000 Binary files a/1.4/Textures/UI/Genes/FullEstrus.png and /dev/null differ diff --git a/1.4/Textures/UI/Genes/NeverEstrus.png b/1.4/Textures/UI/Genes/NeverEstrus.png deleted file mode 100644 index c0c552d..0000000 Binary files a/1.4/Textures/UI/Genes/NeverEstrus.png and /dev/null differ diff --git a/1.4/Textures/UI/Genes/NoBleeding.png b/1.4/Textures/UI/Genes/NoBleeding.png deleted file mode 100644 index 4f10886..0000000 Binary files a/1.4/Textures/UI/Genes/NoBleeding.png and /dev/null differ diff --git a/1.4/Textures/UI/Genes/QuadEggLifetime.png b/1.4/Textures/UI/Genes/QuadEggLifetime.png deleted file mode 100644 index ba8f144..0000000 Binary files a/1.4/Textures/UI/Genes/QuadEggLifetime.png and /dev/null differ diff --git a/1.4/Textures/UI/Genes/QuadOvulation.png b/1.4/Textures/UI/Genes/QuadOvulation.png deleted file mode 100644 index 9f76bbb..0000000 Binary files a/1.4/Textures/UI/Genes/QuadOvulation.png and /dev/null differ diff --git a/1.4/Textures/UI/Genes/ShortEggLifetime.png b/1.4/Textures/UI/Genes/ShortEggLifetime.png deleted file mode 100644 index fe3ce7a..0000000 Binary files a/1.4/Textures/UI/Genes/ShortEggLifetime.png and /dev/null differ diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs index 1100c71..7eb1e66 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs @@ -1,4 +1,5 @@ using AlienRace; +using System; using System.Collections.Generic; using UnityEngine; using Verse; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs index 72724c0..1b1f69c 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs @@ -21,7 +21,7 @@ namespace RJW_Menstruation public const int ColonistTickIntervalDefault = GenDate.TicksPerHour; public const int NonColonistTickIntervalDefault = GenDate.TicksPerHour; public const int AnimalTickIntervalDefault = GenDate.TicksPerHour; - public const int TickIntervalMinimum = GenTicks.TicksPerRealSecond / 3; + public const int TickIntervalMinimum = 20; public const int TickIntervalMaximum = 4 * GenDate.TicksPerHour; public const float EnzygoticTwinsChanceDefault = 0.002f; public const int EnzygoticTwinsChanceAdjustDefault = 2; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Cum.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Cum.cs index 60394b0..eefdfc7 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Cum.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Cum.cs @@ -1,6 +1,7 @@ using RimWorld; using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Text; using UnityEngine; using Verse; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/DrugOutcomeDoers.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/DrugOutcomeDoers.cs index 5017740..33e4e11 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/DrugOutcomeDoers.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/DrugOutcomeDoers.cs @@ -1,4 +1,5 @@ using RimWorld; +using rjw; using System.Collections.Generic; using Verse; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs index 3b4ab9c..08dcf50 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_InducedOvulator.cs @@ -109,7 +109,5 @@ namespace RJW_Menstruation if (curStage == Stage.Luteal && !hadOvulatoryStage) return false; else return base.ShouldBeInEstrus(); } - - protected override float RandomOvulationChance => 0; } } diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs index 3518b5c..e5cfef8 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Menstruation.cs @@ -123,10 +123,11 @@ namespace RJW_Menstruation protected string customwombtex = null; protected string customvagtex = null; protected bool estrusflag = false; - protected float? ovulationChanceCache = null; // Dirtied every simulation - protected float? implantationChanceCache = null; + protected float ovulationChanceCache = -1.0f; // Dirtied every simulation + protected float implantationChanceCache = -1.0f; protected int opcache = -1; protected float antisperm = 0.0f; + protected float? originvagsize = null; // RJW pregnancy, or Biotech pregnancy/labor/laborpushing protected Hediff pregnancy = null; @@ -178,8 +179,7 @@ namespace RJW_Menstruation public float HoursBetweenSimulations => (float)TickInterval / GenDate.TicksPerHour; - public Hediff Pregnancy - { + public Hediff Pregnancy { get { if (pregnancy == null) return null; @@ -255,11 +255,11 @@ namespace RJW_Menstruation public float TotalCum { - get => cums?.Sum(cum => cum.Volume) ?? 0; + get => cums?.Sum(cum => cum.Volume) ?? 0; } public float TotalFertCum { - get => cums?.Where(cum => CumCanFertilize(cum)).Sum(cum => cum.FertVolume) ?? 0; + get => cums?.Sum(cum => cum.FertVolume) ?? 0; } public float TotalCumPercent { @@ -289,7 +289,7 @@ namespace RJW_Menstruation private bool calculatingOvulationChance = false; public bool CalculatingOvulationChance { get => calculatingOvulationChance; } - private float CalculatedOvulationChance() + protected float CalculatedOvulationChance() { float ovulationChance = 1.0f; if (EggHealth <= 0.0f) return 0.0f; @@ -315,20 +315,19 @@ namespace RJW_Menstruation return ovulationChance; } - private float CalculatedImplantChance() + protected float CalculatedImplantChance() { if (ModsConfig.BiotechActive && xxx.is_human(Pawn)) { // Implant factor will be based solely on pawn age, plus any rollover from ovulation chance float factor = 1.0f; StatDefOf.Fertility.GetStatPart()?.TransformValue(StatRequest.For(Pawn), ref factor); - if (factor <= 0.0f) return 0.0f; if (OvulationChance > 1.0f) factor *= OvulationChance; return Props.baseImplantationChanceFactor * FertilityModifier * factor; } else { - return Pawn.health.capacities.GetLevel(xxx.reproduction) * Props.baseImplantationChanceFactor * FertilityModifier * (Pawn.IsBreeder() ? 10.0f : 1.0f); + return Pawn.health.capacities.GetLevel(xxx.reproduction) * Props.baseImplantationChanceFactor * FertilityModifier; } } @@ -336,8 +335,8 @@ namespace RJW_Menstruation { get { - if (ovulationChanceCache == null) ovulationChanceCache = CalculatedOvulationChance(); - return ovulationChanceCache.Value; + if (ovulationChanceCache < 0.0f) ovulationChanceCache = CalculatedOvulationChance(); + return ovulationChanceCache; } } @@ -346,8 +345,8 @@ namespace RJW_Menstruation { get { - if (implantationChanceCache == null) implantationChanceCache = CalculatedImplantChance(); - return implantationChanceCache.Value; + if (implantationChanceCache < 0.0f) implantationChanceCache = CalculatedImplantChance(); + return implantationChanceCache; } } @@ -357,7 +356,7 @@ namespace RJW_Menstruation { if (cums.NullOrEmpty()) yield return Translations.Info_noCum; else foreach (Cum cum in cums) - yield return string.Format("{0}: {1:0.##}ml", cum.notcum ? cum.notcumLabel : cum.pawn?.Label, cum.Volume); + yield return string.Format("{0}: {1:0.##}ml", cum.notcum ? cum.notcumLabel : cum.pawn?.Label, cum.Volume); } } public Color GetCumMixtureColor @@ -564,6 +563,19 @@ namespace RJW_Menstruation } } + public float OriginVagSize + { + get + { + if (originvagsize == null) + { + originvagsize = parent.Severity; + } + return originvagsize ?? 0.1f; + } + set => originvagsize = value; + } + public int CurStageIntervalTicks { get => currentIntervalTicks; @@ -596,7 +608,7 @@ namespace RJW_Menstruation 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 * GenDate.HoursPerDay)); - + return GenMath.LerpDouble(0, discoveryTime, lutealProgressWhenImplanted, 1.0f, pregnancy.Severity); } } @@ -644,6 +656,7 @@ namespace RJW_Menstruation Scribe_Values.Look(ref ovarypower, "ovarypower", ovarypower, true); Scribe_Values.Look(ref eggstack, "eggstack", 0); Scribe_Values.Look(ref estrusflag, "estrusflag", false); + Scribe_Values.Look(ref originvagsize, "originvagsize", originvagsize, true); Scribe_Values.Look(ref DoCleanWomb, "DoCleanWomb", false); Scribe_References.Look(ref pregnancy, "pregnancy"); if (Scribe.mode == LoadSaveMode.PostLoadInit) @@ -666,18 +679,23 @@ namespace RJW_Menstruation ovulationFactor = 1f; noBleeding = false; opcache = -1; - + if (Pawn.genes == null || !ModsConfig.BiotechActive) return; - foreach (MenstruationModExtension extension in Pawn.genes.GenesListForReading.Select(gene => gene.def.GetModExtension()).Where(ext => ext != null)) + + foreach (GeneDef geneDef in Pawn.genes.GenesListForReading.Select(gene => gene.def)) { - eggLifeSpanTicks = (int)(eggLifeSpanTicks * extension.eggLifeTimeFactor); - if (extension.alwaysEstrus) estrusLevel = EstrusLevel.Visible; - else if (extension.neverEstrus) estrusLevel = EstrusLevel.None; - ovulationFactor *= extension.ovulationFactor; - if (extension.noBleeding) noBleeding = true; + if (geneDef == VariousDefOf.ShortEggLifetime) eggLifeSpanTicks = eggLifeSpanTicks * 3 / 4; + else if (geneDef == VariousDefOf.DoubleEggLifetime) eggLifeSpanTicks *= 2; + else if (geneDef == VariousDefOf.QuadEggLifetime) eggLifeSpanTicks *= 4; + + else if (geneDef == VariousDefOf.NeverEstrus) estrusLevel = EstrusLevel.None; + else if (geneDef == VariousDefOf.FullEstrus) estrusLevel = EstrusLevel.Visible; + + else if (geneDef == VariousDefOf.DoubleOvulation) ovulationFactor = 2f; + else if (geneDef == VariousDefOf.QuadOvulation) ovulationFactor = 4f; + + else if (geneDef == VariousDefOf.NoBleeding) noBleeding = true; } - if (eggLifeSpanTicks < 0) eggLifeSpanTicks = 0; - if (ovulationFactor < 0f) ovulationFactor = 0f; } public bool ShouldSimulate() @@ -706,7 +724,7 @@ namespace RJW_Menstruation { if (Pawn.IsHashIntervalTick(recalculateTickInterval)) TickInterval = -1; // Every so often, force TickInterval to be recalculated in case the pawn's status changed. if (!Pawn.IsHashIntervalTick(TickInterval)) return; - + if (!ShouldSimulate()) return; // Initialize immediately if needed, but if there's an error, then don't spam it every tick @@ -715,7 +733,7 @@ namespace RJW_Menstruation Log.Warning($"{Pawn}'s womb is ticking, but was not initialized first"); Initialize(); } - + if (initError) Log.Warning($"Attempting to process {Pawn}'s womb uninitialized"); if (Pregnancy != null && curStage != Stage.Pregnant) @@ -725,7 +743,7 @@ namespace RJW_Menstruation } BeforeSimulator(); - + if (ShouldBeInfertile()) GoNextStage(Stage.Infertile); switch (curStage) { @@ -802,7 +820,7 @@ namespace RJW_Menstruation tip.Append(": "); tip.Append(GetCurStageLabel); string fertInfo = GetFertilizingInfo; - if (CurrentVisibleStage == Stage.Luteal && fertInfo.Length > 0) + if(CurrentVisibleStage == Stage.Luteal && fertInfo.Length > 0) { tip.AppendLine(); tip.Append(fertInfo); @@ -813,7 +831,7 @@ namespace RJW_Menstruation protected virtual int TicksToNextStage() { - return Math.Max(0, (currentIntervalTicks - curStageTicks) / Configurations.CycleAcceleration); + return Math.Max(0,(currentIntervalTicks - curStageTicks) / Configurations.CycleAcceleration); } public override string CompDebugString() @@ -1158,7 +1176,7 @@ namespace RJW_Menstruation if (cycleSpeed < 0f) cycleSpeed = Utility.RandGaussianLike(0.8f, 1.2f); if (cycleVariability < 0f) cycleVariability = MenstruationUtility.RandomVariabilityPercent(); - + InitOvary(); if (currentIntervalTicks < 0) @@ -1266,8 +1284,8 @@ namespace RJW_Menstruation protected virtual void BeforeSimulator() { - ovulationChanceCache = null; - implantationChanceCache = null; + ovulationChanceCache = -1.0f; + implantationChanceCache = -1.0f; CumOut(); } @@ -1335,18 +1353,10 @@ namespace RJW_Menstruation } } - public bool CumCanFertilize(Cum cum) - { - return !cum.notcum && - cum.FertVolume > 0 && - !(cum.pawn?.Destroyed ?? true) && - (RJWPregnancySettings.bestial_pregnancy_enabled || xxx.is_animal(Pawn) == xxx.is_animal(cum.pawn)); - } - protected Pawn Fertilize() { if (cums.NullOrEmpty()) return null; - List eligibleCum = cums.FindAll(cum => CumCanFertilize(cum)); + 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); @@ -1354,7 +1364,7 @@ namespace RJW_Menstruation //float fertFailChancePerHour = Mathf.Pow(1.0f - Configurations.FertilizeChance, totalFertPower * Props.basefertilizationChanceFactor); //float fertFailChancePerInterval = Mathf.Pow(fertFailChancePerHour, (float)TickInterval / GenDate.TicksPerHour); float fertFailChancePerInterval = Mathf.Pow(1.0f - Configurations.FertilizeChance, totalFertPower * Props.basefertilizationChanceFactor * HoursBetweenSimulations); - + if (Rand.Chance(fertFailChancePerInterval)) return null; Pawn.records.AddTo(VariousDefOf.AmountofFertilizedEggs, 1); @@ -1484,7 +1494,7 @@ namespace RJW_Menstruation float interspeciesFactor = InterspeciesImplantFactor(egg.fertilizer); float implantChance = Configurations.ImplantationChance * ImplantChance * interspeciesFactor; Log.Message($"Fertilized egg of {Pawn} failed to implant (chance {implantChance.ToStringPercent()}, " + - (interspeciesFactor < 1.0f ? $"interspecies factor {interspeciesFactor.ToStringPercent()}, " : "") + + (interspeciesFactor < 1.0f ? $"interspecies factor {interspeciesFactor.ToStringPercent()}, " : "" ) + $"father {egg.fertilizer})"); } deadeggs.Add(egg); @@ -1515,7 +1525,7 @@ namespace RJW_Menstruation protected void BleedOut() { // ~1.5 per hour times acceleration - float bledAmount = Utility.VariationRange(0.03f * Configurations.BleedingAmount * Configurations.CycleAcceleration * HoursBetweenSimulations, 0.5f); + float bledAmount = 0.03f * Configurations.BleedingAmount * Configurations.CycleAcceleration * Rand.Range(0.5f, 1.5f) * HoursBetweenSimulations; CumIn(Pawn, bledAmount, Translations.Menstrual_Blood, -5.0f, Pawn.RaceProps?.BloodDef ?? ThingDefOf.Filth_Blood); Cum blood = GetNotCum(Translations.Menstrual_Blood); if (blood != null) blood.Color = BloodColor; @@ -1570,6 +1580,9 @@ namespace RJW_Menstruation return amount; } + + + protected void EggDecay() { HashSet deadeggs = new HashSet(); @@ -1589,7 +1602,7 @@ namespace RJW_Menstruation protected void AddCrampPain() { Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_MenstrualCramp, Pawn); - hediff.Severity = Utility.VariationRange(crampPain, 0.1f); + hediff.Severity = crampPain * Rand.Range(0.9f, 1.1f); HediffCompProperties_SeverityPerDay Prop = (HediffCompProperties_SeverityPerDay)hediff.TryGetComp().props; Prop.severityPerDay = -hediff.Severity / (currentIntervalTicks / GenDate.TicksPerDay) * Configurations.CycleAcceleration; Pawn.health.AddHediff(hediff, parent.Part); @@ -1646,7 +1659,7 @@ namespace RJW_Menstruation eggnum = 1f; } eggnum *= ovulationFactor; - int toOvulate = Math.Max(1, (int)eggnum + eggstack); + int toOvulate = (int)eggnum + eggstack; int ovulated = 0; for (int i = 0; i < toOvulate; i++) @@ -1657,7 +1670,7 @@ namespace RJW_Menstruation } ovarypower -= ovulated; eggstack = 0; - if (Configurations.Debug && ovulated < toOvulate) + if (Configurations.Debug && ovulated != toOvulate) Log.Message($"{Pawn} ovulated {ovulated}/{toOvulate} eggs ({OvulationChance.ToStringPercent()} chance)"); GoNextStage(Stage.Luteal); @@ -1804,10 +1817,10 @@ namespace RJW_Menstruation } else pawnMemories.TryGainMemory(VariousDefOf.CameInsideFFetish, cummer); } - else if (Pawn.relations.OpinionOf(cummer) <= -5) - pawnMemories.TryGainMemory(VariousDefOf.HaterCameInsideF, cummer); - else if (Pawn.IsInEstrus() && Pawn.relations.OpinionOf(cummer) < RJWHookupSettings.MinimumRelationshipToHookup) - pawnMemories.TryGainMemory(VariousDefOf.HaterCameInsideFEstrus, cummer); + else if (Pawn.relations.OpinionOf(cummer) <= -5) + pawnMemories.TryGainMemory(VariousDefOf.HaterCameInsideF, cummer); + else if (Pawn.IsInEstrus() && Pawn.relations.OpinionOf(cummer) < RJWHookupSettings.MinimumRelationshipToHookup) + pawnMemories.TryGainMemory(VariousDefOf.HaterCameInsideFEstrus, cummer); else if (!Pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, cummer) && !Pawn.relations.DirectRelationExists(PawnRelationDefOf.Fiance, cummer)) { if (Pawn.health.capacities.GetLevel(xxx.reproduction) < 0.50f) pawnMemories.TryGainMemory(VariousDefOf.CameInsideFLowFert, cummer); @@ -1868,15 +1881,15 @@ namespace RJW_Menstruation switch (stage) { case Stage.Follicular: - return (int)(Utility.VariationRange(Props.follicularIntervalDays * GenDate.TicksPerDay, cycleVariability * 1.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 1.5f)); + return (int)(Props.follicularIntervalDays * GenDate.TicksPerDay * (1 + Rand.Range(-cycleVariability, cycleVariability) * 1.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 1.5f)); case Stage.Ovulatory: return Props.ovulationIntervalHours * GenDate.TicksPerHour; // No variability for now case Stage.Luteal: - return (int)(Utility.VariationRange(Props.lutealIntervalDays * GenDate.TicksPerDay, cycleVariability * 0.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 0.5f)); + return (int)(Props.lutealIntervalDays * GenDate.TicksPerDay * (1 + Rand.Range(-cycleVariability, cycleVariability) * 0.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 0.5f)); case Stage.Bleeding: - return (int)(Utility.VariationRange(Props.bleedingIntervalDays * GenDate.TicksPerDay, cycleVariability * 0.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 0.5f)); + return (int)(Props.bleedingIntervalDays * GenDate.TicksPerDay * (1 + Rand.Range(-cycleVariability, cycleVariability) * 0.5f * variabilityFactor) / (1 + (cycleSpeed - 1) * 0.5f)); case Stage.Recover: - return (int)Utility.VariationRange(Props.recoveryIntervalDays * GenDate.TicksPerDay, 0.05f); + return (int)(Props.recoveryIntervalDays * GenDate.TicksPerDay * Rand.Range(0.95f, 1.05f)); case Stage.Pregnant: return (int)(MenstruationUtility.GestationHours(pregnancy) * GenDate.TicksPerHour); default: @@ -1904,13 +1917,10 @@ namespace RJW_Menstruation else return Rand.Range(0.6f, 1.0f); } - protected virtual float RandomOvulationChance => (float)Props.ovulationIntervalHours / GenDate.HoursPerDay; - protected Stage RandomStage() { Stage stage = Rand.ElementByWeight( Stage.Follicular, Props.follicularIntervalDays - Props.bleedingIntervalDays, - Stage.Ovulatory, RandomOvulationChance, Stage.Luteal, Props.lutealIntervalDays, Stage.Bleeding, Props.bleedingIntervalDays); @@ -1919,9 +1929,6 @@ namespace RJW_Menstruation case Stage.Follicular: curStageTicks = Rand.Range(0, (Props.follicularIntervalDays - Props.bleedingIntervalDays) * GenDate.TicksPerDay); break; - case Stage.Ovulatory: - curStageTicks = Rand.Range(0, Props.ovulationIntervalHours * GenDate.TicksPerHour); - break; case Stage.Luteal: curStageTicks = Rand.Range(0, Props.lutealIntervalDays * GenDate.TicksPerDay); break; @@ -2022,6 +2029,28 @@ namespace RJW_Menstruation public class HediffComp_Anus : HediffComp { - public CompProperties_Anus Props => (CompProperties_Anus)props; + protected float? originanussize; + + public float OriginAnusSize + { + get + { + if (originanussize == null) + { + originanussize = parent.Severity; + } + return originanussize ?? 0.1f; + } + } + + public override void CompExposeData() + { + base.CompExposeData(); + Scribe_Values.Look(ref originanussize, "originanussize", originanussize, true); + } + + public override void CompPostTick(ref float severityAdjustment) + { + } } } diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs index cfb9a16..eb344c3 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PeriodicOvulator.cs @@ -1,4 +1,5 @@ using RimWorld; +using System.Linq; using Verse; namespace RJW_Menstruation @@ -28,14 +29,14 @@ namespace RJW_Menstruation protected override void InitializeExtraValues() { - base.InitializeExtraValues(); + base.InitializeExtraValues(); if (averageCycleIntervalTicks < 0) { averageCycleIntervalTicks = (int)(Props.cycleIntervalDays.RandomInRange * GenDate.TicksPerDay / cycleSpeed); if (ticksToNextCycle < -50000) ticksToNextCycle = Rand.Range(0, averageCycleIntervalTicks); // Make the cutoff halfway into cycle, just to be sure there isn't a double-cycle the first time - if ((curStage == Stage.Follicular || curStage == Stage.Ovulatory || curStage == Stage.Luteal || curStage == Stage.Bleeding) + if ((curStage == Stage.Follicular || curStage == Stage.Luteal || curStage == Stage.Bleeding) && (averageCycleIntervalTicks - ticksToNextCycle) / 2 >= GenDate.TicksPerDay * (Props.follicularIntervalDays + Props.lutealIntervalDays) / cycleSpeed) GoNextStage(Stage.Anestrus); } @@ -98,14 +99,14 @@ namespace RJW_Menstruation base.PregnantAction(); if (curStage != Stage.Pregnant) // Go halfway into the cycle - ticksToNextCycle = (int)Utility.VariationRange(averageCycleIntervalTicks, cycleVariability) / 2; + ticksToNextCycle = (int)(averageCycleIntervalTicks * (1 + Rand.Range(-cycleVariability, cycleVariability))) / 2; } protected override void AnestrusAction() { if (ticksToNextCycle <= 0 && IsBreedingSeason()) { - ticksToNextCycle = (int)Utility.VariationRange(averageCycleIntervalTicks, cycleVariability); + ticksToNextCycle = (int)(averageCycleIntervalTicks * (1 + Rand.Range(-cycleVariability, cycleVariability))); GoNextStage(Stage.Follicular); } } diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Pheromones.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Pheromones.cs index 130edcc..42b2aac 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Pheromones.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Pheromones.cs @@ -1,7 +1,6 @@  using RimWorld; -using RimWorld.Planet; using rjw; using System; using System.Collections.Generic; @@ -47,8 +46,6 @@ namespace RJW_Menstruation protected IEnumerable AffectedPawns() { - if(Pawn.GetCaravan() is Caravan caravan) - foreach (Pawn p in caravan.PawnsListForReading.Where(p => p != Pawn)) yield return p; Map mapHeld = Pawn.MapHeld; if (mapHeld == null) yield break; foreach (Pawn pawn in mapHeld.mapPawns.AllPawnsSpawned) diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs index 4ce241f..79c13a9 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_PregeneratedBabies.cs @@ -1,4 +1,5 @@ using HarmonyLib; +using Mono.Cecil.Cil; using RimWorld; using rjw; using System; @@ -202,7 +203,7 @@ namespace RJW_Menstruation if (comp?.HasBaby ?? false) { OutcomeChance thisOutcome = outcome; - Precept_Ritual precept_Ritual = (Precept_Ritual)comp.Pawn.Ideo.GetPrecept(RimWorld.PreceptDefOf.ChildBirth); + Precept_Ritual precept_Ritual = (Precept_Ritual)comp.Pawn.Ideo.GetPrecept(PreceptDefOf.ChildBirth); float birthQuality = PregnancyUtility.GetBirthQualityFor(mother); do { diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs index 394c376..75c796f 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -1,10 +1,14 @@ using RimWorld; +using RimWorld.Planet; using rjw; using System; using System.Collections.Generic; +using System.Diagnostics.Eventing.Reader; using System.Linq; +using System.Text; using UnityEngine; using Verse; +using Verse.AI; namespace RJW_Menstruation { @@ -137,7 +141,7 @@ namespace RJW_Menstruation else if (gestationProgress < 0.8f) icon = fetustex + "04"; else icon = fetustex + "05"; - return TryGetTwinsIcon(icon, babycount) ?? ContentFinder.Get(icon, true); + return TryGetTwinsIcon(icon, babycount) ?? ContentFinder.Get((icon), true); } public static Texture2D TryGetTwinsIcon(string path, int babycount) @@ -156,7 +160,7 @@ namespace RJW_Menstruation List insectEggs = new List(); comp.Pawn.health.hediffSet.GetHediffs(ref insectEggs); - if (insectEggs?.Sum(hediff => hediff.eggssize) > 1.0f) return null; // same logic as "Stuffed" in GetInsectEggedIcon + if (!insectEggs.NullOrEmpty() && insectEggs.Sum(hediff => hediff.eggssize) > 1.0f) return null; // same logic as "Stuffed" in GetInsectEggedIcon string icon = comp.WombTex; float cumpercent = comp.TotalCumPercent; @@ -179,7 +183,7 @@ namespace RJW_Menstruation else if (cumpercent < 0.89f) icon += "_Cum_15"; else if (cumpercent < 0.95f) icon += "_Cum_16"; else icon += "_Cum_17"; - Texture2D cumtex = ContentFinder.Get(icon, true); + Texture2D cumtex = ContentFinder.Get((icon), true); return cumtex; } public static Texture2D GetInsectEggedIcon(this HediffComp_Menstruation comp) @@ -302,13 +306,15 @@ namespace RJW_Menstruation } - public static Texture2D GetGenitalIcon(this Pawn pawn, HediffComp_Menstruation comp) + public static Texture2D GetGenitalIcon(this Pawn pawn, HediffComp_Menstruation comp, bool drawOrigin = false) { Hediff hediff = comp?.parent; if (hediff == null) return ContentFinder.Get("Genitals/Vagina00", true); //HediffComp_Menstruation comp = hediff.GetMenstruationComp(); string icon; - float severity = hediff.Severity; + float severity; + if (drawOrigin) severity = comp.OriginVagSize; + else severity = hediff.Severity; if (comp != null) icon = comp.VagTex; else icon = "Genitals/Vagina"; @@ -325,18 +331,30 @@ namespace RJW_Menstruation else if (severity < 1.01f) icon += "10"; //cavernous else icon += "11"; //abyssal - return ContentFinder.Get(icon, true); + return ContentFinder.Get((icon), true); } - public static Texture2D GetAnalIcon(this Pawn pawn) + public static Texture2D GetAnalIcon(this Pawn pawn, bool drawOrigin = false) { Hediff hediff = pawn.health.hediffSet.hediffs.FirstOrDefault(h => VariousDefOf.AllAnuses.Contains(h.def)) ?? pawn.health.hediffSet.hediffs.FirstOrDefault(h => h.def.defName.ToLower().Contains("anus")); - if (hediff == null) return ContentFinder.Get("Genitals/Anal00", true); - - string icon = ((CompProperties_Anus)hediff.GetAnusComp()?.props)?.analTex ?? "Genitals/Anal"; - float severity = hediff.Severity; + if (hediff == null) return ContentFinder.Get(("Genitals/Anal00"), true); + string icon; + float severity; + HediffComp_Anus comp = hediff.GetAnusComp(); + if (comp != null) + { + CompProperties_Anus Props = (CompProperties_Anus)comp.props; + icon = Props.analTex ?? "Genitals/Anal"; + if (drawOrigin) severity = comp.OriginAnusSize; + else severity = hediff.Severity; + } + else + { + icon = "Genitals/Anal"; + severity = hediff.Severity; + } if (severity < 0.20f) icon += "00"; //micro else if (severity < 0.40f) icon += "01"; //tight else if (severity < 0.60f) icon += "02"; //average @@ -344,7 +362,7 @@ namespace RJW_Menstruation else if (severity < 1.01f) icon += "04"; //cavernous else icon += "05"; //abyssal - return ContentFinder.Get(icon, true); + return ContentFinder.Get((icon), true); } public static float GestationHours(this Hediff hediff) @@ -380,8 +398,7 @@ namespace RJW_Menstruation if (!Configurations.EnableAnimalCycle && pawn.IsAnimal()) return false; if (pawn.GetComp() != null) return false; if (pawn.RaceHasOviPregnancy()) return false; - - if (ModsConfig.BiotechActive && pawn.genes != null && + if (ModsConfig.BiotechActive && pawn.genes != null && pawn.genes.GenesListForReading.Select(gene => gene.def).Intersect(VariousDefOf.EggLayerGenes).Any()) return false; return true; @@ -435,7 +452,7 @@ namespace RJW_Menstruation if (precept != null) return true; else return pawn.IsBreeder() || - pawn.HasImpregnationFetish(); + pawn.HasImpregnationFetish(); } public static float DamagePants(this Pawn pawn, float fluidAmount) diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_Estrus.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_Estrus.cs index 26fa191..6c7f462 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_Estrus.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_Estrus.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using RimWorld; +using System.Collections.Generic; using System.Linq; using Verse; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index b7877d2..61ce541 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -1,7 +1,10 @@ using RimWorld; using rjw; +using System; using System.Collections.Generic; using System.Linq; +using System.Reflection; +using System.Text; using Verse; namespace RJW_Menstruation diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/MenstruationModExtension.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/MenstruationModExtension.cs deleted file mode 100644 index c3a8fbe..0000000 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/MenstruationModExtension.cs +++ /dev/null @@ -1,15 +0,0 @@ -using Verse; - -namespace RJW_Menstruation -{ - public class MenstruationModExtension : DefModExtension - { - public float eggLifeTimeFactor = 1.0f; - public bool neverEstrus = false; - public bool alwaysEstrus = false; - public float ovulationFactor = 1.0f; - public bool noBleeding = false; - - public bool disableCycle = false; - } -} diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs index 0125f26..eb8777a 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Biotech_Patch.cs @@ -1,11 +1,11 @@ using HarmonyLib; -using RimWorld; -using System; -using System.Collections.Generic; using System.Linq; -using System.Reflection; -using System.Reflection.Emit; +using RimWorld; using Verse; +using System.Collections.Generic; +using System.Reflection; +using System; +using System.Reflection.Emit; namespace RJW_Menstruation { @@ -195,9 +195,8 @@ namespace RJW_Menstruation [HarmonyPatch(typeof(Pawn_GeneTracker), "Notify_GenesChanged")] public class Notify_GenesChanged_Patch { - public static void Postfix(Pawn_GeneTracker __instance, GeneDef addedOrRemovedGene) + public static void Postfix(Pawn_GeneTracker __instance) { - if (!addedOrRemovedGene.HasModExtension()) return; foreach (HediffComp_Menstruation comp in __instance.pawn.GetMenstruationComps()) comp.Notify_UpdatedGenes(); } diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Gizmo_Patch.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Gizmo_Patch.cs index 92b8b16..b0ab1a3 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Gizmo_Patch.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Gizmo_Patch.cs @@ -2,6 +2,7 @@ using RimWorld; using rjw; using System.Collections.Generic; +using System.Linq; using System.Text; using UnityEngine; using Verse; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs index 6e86da5..7194d0e 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Harmony.cs @@ -1,4 +1,5 @@ -using HarmonyLib; +using AlienRace; +using HarmonyLib; using rjw; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Rules.PartKindUsageRules; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs index c2f1176..98e5997 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/Pawn_Patch.cs @@ -1,5 +1,6 @@ using HarmonyLib; using RimWorld; +using rjw; using System; using System.Collections.Generic; using System.Linq; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/PregnancyCommon.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/PregnancyCommon.cs index 9b9bdad..7cbf28c 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/PregnancyCommon.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/PregnancyCommon.cs @@ -20,8 +20,9 @@ namespace RJW_Menstruation StringBuilder res = new StringBuilder(); + IEnumerable babiesdistinct = babies.Distinct(new RaceComparer()); int iteration = 0; - foreach (Pawn baby in babies.Distinct(new RaceComparer())) + foreach (Pawn baby in babiesdistinct) { int num = babies.Where(x => x.def.Equals(baby.def)).Count(); if (iteration > 0) res.Append(", "); @@ -42,8 +43,9 @@ namespace RJW_Menstruation if (!is_parent_known && Configurations.InfoDetail != Configurations.DetailLevel.All) return res.Append(Translations.Dialog_FatherUnknown).ToString(); + IEnumerable babiesdistinct = babies.Distinct(new FatherComparer(mother)); int iteration = 0; - foreach (Pawn baby in babies.Distinct(new FatherComparer(mother))) + foreach (Pawn baby in babiesdistinct) { if (iteration > 0) res.Append(", "); res.Append(Utility.GetFather(baby, mother)?.LabelShort ?? Translations.Dialog_FatherUnknown); diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj b/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj index 2577bb6..0c4aa45 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj @@ -74,7 +74,6 @@ - @@ -109,6 +108,10 @@ ..\..\..\..\..\..\..\..\workshop\content\294100\2830943477\1.4\Assemblies\AnimalGenetics.dll False + + ..\..\..\..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll + False + ..\..\..\..\..\rjw\1.4\Assemblies\RJW.dll False @@ -169,9 +172,6 @@ - - 1.4.3901 - 2.2.2 runtime diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Things.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Things.cs index c95454a..cfee336 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Things.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Things.cs @@ -219,14 +219,14 @@ namespace RJW_Menstruation public void CheckDirty() { - if (absorbedfluids > this.GetStatValue(VariousDefOf.MaxAbsorbable) && !(Wearer?.apparel?.IsLocked(this) ?? false) && DirtyDef != def && DirtyDef != null) + if (absorbedfluids > this.GetStatValue(VariousDefOf.MaxAbsorbable) && !(Wearer?.apparel?.IsLocked(this) ?? false)) { - bool oldHasStats = !def.equippedStatOffsets.NullOrEmpty(); - bool newHasStats = !DirtyDef.equippedStatOffsets.NullOrEmpty(); def = DirtyDef; dirty = true; - Wearer.outfits?.forcedHandler?.SetForced(this, false); - if (oldHasStats || newHasStats) + OutfitForcedHandler forcedHandler = Wearer.outfits?.forcedHandler; + if (forcedHandler?.IsForced(this) ?? false) + forcedHandler.SetForced(this, false); + if (!def.equippedStatOffsets.NullOrEmpty()) Wearer.health.capacities.Notify_CapacityLevelsDirty(); Wearer.apparel.Notify_ApparelChanged(); } @@ -272,7 +272,7 @@ namespace RJW_Menstruation public override void DirtyEffect(int tickInterval) { - if (wearTicks > MinHrstoDirtyEffect * GenDate.TicksPerHour && Rand.MTBEventOccurs(100.0f, GenDate.TicksPerHour, tickInterval) && !(Wearer.apparel?.IsLocked(this) ?? false)) + if (wearTicks > MinHrstoDirtyEffect * GenDate.TicksPerHour && Rand.MTBEventOccurs(100.0f, GenDate.TicksPerHour, tickInterval) && !Wearer.apparel.IsLocked(this)) { Wearer.health.AddHediff(HediffDefOf.WoundInfection, Genital_Helper.get_genitalsBPR(Wearer)); } diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs index 2820b53..0448aac 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs @@ -227,7 +227,7 @@ namespace RJW_Menstruation string feinfo = PregnancyCommon.GetBabyInfo(babiescomp?.babies); string fainfo = PregnancyCommon.GetFatherInfo(babiescomp?.babies, babiescomp.Pawn, true) + " "; // Keep all parents known, for now - if (feinfo == "Null") feinfo = "1 " + (p.Mother ?? pawn).def.label + " " + Translations.Dialog_WombInfo02; + if (feinfo == "Null") feinfo = "1 " + p.Mother.def.label + " " + Translations.Dialog_WombInfo02; if (fainfo == "Null ") { string father = p.Father?.LabelShort ?? Translations.Dialog_FatherUnknown; @@ -388,9 +388,10 @@ namespace RJW_Menstruation Rect genitalIconRect = new Rect(rect.x, rect.y + fontheight, genitalRectWidth, genitalRectHeight); Rect genitalVaginaLabelRect = new Rect(rect.x, rect.y + 10f, genitalRectWidth, fontheight); Rect genitalAnusLabelRect = new Rect(rect.x, rect.y + fontheight + genitalRectHeight, genitalRectWidth, fontheight); + bool showOrigin = Mouse.IsOver(genitalIconRect) && Input.GetMouseButton(0); - vagina = pawn.GetGenitalIcon(comp); - anal = pawn.GetAnalIcon(); + vagina = pawn.GetGenitalIcon(comp, showOrigin); + anal = pawn.GetAnalIcon(showOrigin); GUI.color = new Color(1.00f, 0.47f, 0.47f, 1); GUI.Box(rect, "", boxstyle); GUI.color = Utility.SafeSkinColor(pawn); diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index 0020d86..ae2cb4a 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -80,7 +80,7 @@ namespace RJW_Menstruation try { - res = VariationRange(part.FluidAmmount * part.FluidModifier * pawn.BodySize / pawn.RaceProps.baseBodySize, 0.2f); + res = part.FluidAmmount * part.FluidModifier * pawn.BodySize / pawn.RaceProps.baseBodySize * Rand.Range(0.8f, 1.2f); } catch (NullReferenceException) { diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs index 16903b2..e3f8f66 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/VariousDefOf.cs @@ -45,6 +45,14 @@ namespace RJW_Menstruation public static readonly RecordDef AmountofCreampied = DefDatabase.GetNamed("AmountofCreampied"); public static readonly RecordDef AmountofFertilizedEggs = DefDatabase.GetNamed("AmountofFertilizedEggs"); public static readonly TaleDef TaleCameInside = DefDatabase.GetNamed("CameInside"); + public static readonly GeneDef ShortEggLifetime = DefDatabase.GetNamed("Menstruation_ShortEggLifetime"); + public static readonly GeneDef DoubleEggLifetime = DefDatabase.GetNamed("Menstruation_DoubleEggLifetime"); + public static readonly GeneDef QuadEggLifetime = DefDatabase.GetNamed("Menstruation_QuadEggLifetime"); + public static readonly GeneDef NeverEstrus = DefDatabase.GetNamed("Menstruation_NeverEstrus"); + public static readonly GeneDef FullEstrus = DefDatabase.GetNamed("Menstruation_FullEstrus"); + public static readonly GeneDef DoubleOvulation = DefDatabase.GetNamed("Menstruation_DoubleOvulation"); + public static readonly GeneDef QuadOvulation = DefDatabase.GetNamed("Menstruation_QuadOvulation"); + public static readonly GeneDef NoBleeding = DefDatabase.GetNamed("Menstruation_NoBleeding"); private static List allraces = null; private static List allkinds = null; @@ -58,8 +66,9 @@ namespace RJW_Menstruation get { if (allraces != null) return allraces; - allraces = DefDatabase.AllDefsListForReading.Where(thingdef => thingdef.race?.IsFlesh ?? false).ToList(); + List allThings = DefDatabase.AllDefsListForReading; + allraces = allThings.FindAll(x => x.race != null && x.race.IsFlesh); return allraces; } } @@ -68,8 +77,9 @@ namespace RJW_Menstruation get { if (allkinds != null) return allkinds; - allkinds = DefDatabase.AllDefsListForReading.Where(pawnkinddef => pawnkinddef.race != null).ToList(); + List allKinds = DefDatabase.AllDefsListForReading; + allkinds = allKinds.FindAll(x => x.race != null); return allkinds; } } @@ -147,7 +157,13 @@ namespace RJW_Menstruation get { if (egglayergenes != null) return egglayergenes; - egglayergenes = DefDatabase.AllDefsListForReading.Where(geneDef => geneDef.GetModExtension()?.disableCycle ?? false).ToHashSet(); + egglayergenes = new HashSet + { + DefDatabase.GetNamedSilentFail("AG_EggLaying"), // Alpha Genes + DefDatabase.GetNamedSilentFail("VRESaurids_Oviparous"), // VE Saurid + DefDatabase.GetNamedSilentFail("VRE_SaplingBirth"), // VE Phytokin + }; + egglayergenes.Remove(null); return egglayergenes; } diff --git a/About/About.xml b/About/About.xml index c4c11a0..9c10224 100644 --- a/About/About.xml +++ b/About/About.xml @@ -1,9 +1,7 @@ - rjw.menstruation RJW Menstruation Cycle lutepickle - https://gitgud.io/lutepickle/rjw_menstruation/
  • 1.2
  • 1.3
  • @@ -30,17 +28,13 @@
  • Abraxas.RJW.RaceSupport
  • rjw.milk.humanoid
  • - - -
  • conit.thebirdsandthebees
  • -
    -
    + rjw.menstruation Adds menstruation mechanics to vaginas: Wombs cycle between follicular, luteal, and bleeding phases Tracks eggs ovulated and cum in wombs to determine pregnancy Womb icon and status window -Estrus and pheromone effects +Estrus effects Race-specific fetus images for many vanilla animals Pregnancies from multiple eggs and different fathers Identical siblings diff --git a/About/Manifest.xml b/About/Manifest.xml index 09e409c..6b4c770 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ RJW Menstruation - 1.0.9.4 + 1.0.9.3 diff --git a/changelogs.txt b/changelogs.txt index 4c92c4f..e6f1bf5 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,8 +1,3 @@ -Version 1.0.9.4 - - Added graphics for the menstruation genes with thanks to Alpenglow. - - Pawns in estrus now give their pheromones to their caravan-mates. - - Pawns with the egglaying genes from Erin's Corvyia and Outland - Genetics no longer have a menstrual cycle. - Version 1.0.9.3 - The biosculptor egg restoration cycle will now give more eggs to races that ovulate more than one egg at a time. - All pawns can now use all menstruation genes, regardless of gender or having a womb.