diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll index 32d579b..0215954 100644 Binary files a/1.4/Assemblies/RJW_Menstruation.dll and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/Patches/Hediffs_PrivateParts_Animal.xml b/1.4/Patches/Hediffs_PrivateParts_Animal.xml index 63b12b5..fc60760 100644 --- a/1.4/Patches/Hediffs_PrivateParts_Animal.xml +++ b/1.4/Patches/Hediffs_PrivateParts_Animal.xml @@ -11,6 +11,27 @@ + /Defs/rjw.HediffDef_PartBase[defName="DogVagina"] + + +
  • + 8 + 1.0 + 1.0 + 14 + 166 + 8 + 15 + 4 + Womb/Womb + Genitals/Vagina + 9 +
  • +
    +
    +
    + + /Defs/rjw.HediffDef_PartBase[defName="CatVagina"] diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/FilthMaker_Colored.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/FilthMaker_Colored.cs index fbb4723..a14e186 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/FilthMaker_Colored.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/FilthMaker_Colored.cs @@ -28,7 +28,10 @@ namespace RJW_Menstruation } } } - filth?.AddSources(sources); + if (filth != null) + { + filth.AddSources(sources); + } return false; } if (filth != null) 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 d069069..3bccc44 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 @@ -75,7 +75,7 @@ namespace RJW_Menstruation case Stage.Ovulatory: return true; case Stage.Luteal: - return IsEggExist && curStageHrs < EggLifespanHours; + return IsEggExist && curStageHrs < EggLifespanHours * 24; default: return false; } @@ -93,7 +93,7 @@ namespace RJW_Menstruation case Stage.Ovulatory: return true; case Stage.Luteal: - return IsEggExist && curStageHrs < EggLifespanHours; + return IsEggExist && curStageHrs < EggLifespanHours * 24; default: return false; } 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 ef575f0..070c6ef 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 @@ -498,7 +498,7 @@ namespace RJW_Menstruation case Stage.Ovulatory: return true; case Stage.Luteal: - return curStageHrs < EggLifespanHours; + return curStageHrs < EggLifespanHours * 24; default: return false; } @@ -744,38 +744,6 @@ namespace RJW_Menstruation base.CompPostPostRemoved(); } - public override string CompTipStringExtra - { - get - { - StringBuilder tip = new StringBuilder(); - tip.Append(Translations.Dialog_WombInfo01); - tip.Append(": "); - tip.Append(GetCurStageLabel); - string fertInfo = GetFertilizingInfo; - if(CurrentVisibleStage == Stage.Luteal && fertInfo.Length > 0) - { - tip.AppendLine(); - tip.Append(fertInfo); - } - return tip.ToString(); - } - } - - protected virtual int HoursToNextStage() - { - return Math.Max(0,(currentIntervalHours - curStageHrs) / Configurations.CycleAcceleration); - } - - public override string CompDebugString() - { - if (curStage == Stage.None || curStage == Stage.Infertile || curStage == Stage.Pregnant) return base.CompDebugString(); - StringBuilder debugString = new StringBuilder(); - debugString.Append($"Time to next state: "); - debugString.Append(GenDate.ToStringTicksToPeriod(HoursToNextStage() * GenDate.TicksPerHour)); - return debugString.ToString(); - } - /// /// Get fluid in womb that not a cum /// @@ -1232,7 +1200,7 @@ namespace RJW_Menstruation case Stage.Ovulatory: return true; case Stage.Luteal: - return curStageHrs < EggLifespanHours; + return curStageHrs < EggLifespanHours * 24; default: return false; } @@ -1563,7 +1531,7 @@ namespace RJW_Menstruation ovulated = (int)eggnum + eggstack; for (int i = 0; i < ovulated; i++) - eggs.Add(new Egg((int)(EggLifespanHours / CycleFactor))); + eggs.Add(new Egg((int)(EggLifespanHours * 24 / CycleFactor))); ovarypower -= ovulated; eggstack = 0; 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 6611547..b3fa2ac 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 @@ -57,12 +57,6 @@ namespace RJW_Menstruation Scribe_Values.Look(ref averageCycleIntervalHours, "averageCycleIntervalHours", averageCycleIntervalHours, true); } - protected override int HoursToNextStage() - { - if (curStage == Stage.Anestrus && hoursToNextCycle > 0) return hoursToNextCycle / Configurations.CycleAcceleration; - else return base.HoursToNextStage(); - } - protected override void BleedingAction() { if (curStageHrs >= currentIntervalHours) 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 979077a..51b497a 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 @@ -79,7 +79,6 @@ namespace RJW_Menstruation kind: babyPawnKind, faction: mother.Faction, allowDowned: true, - // fixedLastName seems not to actually do anything, as we eventually end up in PawnBioAndNameGenerator.NameResolvedFrom, which ignores its forcedLastName argument fixedLastName: (string)RandomLastName.Invoke(null, new object[] { mother, mother, xxx.is_human(father) ? father : null }), forceNoIdeo: true, forcedEndogenes: PregnancyUtility.GetInheritedGenes(father, mother), @@ -208,7 +207,8 @@ namespace RJW_Menstruation do { Pawn baby = comp.babies[0]; - Pawn thisFather = baby.GetFather() ?? father; + Pawn thisFather = baby.GetFather(); + if (thisFather == null) thisFather = father; baby.relations.ClearAllRelations(); // To keep ApplyBirthOutcome from erroring when it tries to set up relations PregnancyUtility.ApplyBirthOutcome(thisOutcome, quality, ritual, genes, geneticMother, birtherThing, thisFather, doctor, lordJobRitual, assignments); @@ -258,7 +258,8 @@ namespace RJW_Menstruation do { Pawn baby = comp.babies[0]; - Pawn thisFather = baby.GetFather() ?? father; + Pawn thisFather = baby.GetFather(); + if (thisFather == null) thisFather = father; baby.relations.ClearAllRelations(); PregnancyUtility.ApplyBirthOutcome(outcome, quality, ritual, genes, geneticMother, birtherThing, thisFather, doctor, lordJobRitual, assignments); 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 a7e2918..43e2717 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -151,7 +151,10 @@ namespace RJW_Menstruation else if (gestationProgress < 0.8f) icon = fetustex + "04"; else icon = fetustex + "05"; - return TryGetTwinsIcon(icon, babycount) ?? ContentFinder.Get((icon), true); + Texture2D result = TryGetTwinsIcon(icon, babycount); + + if (result == null) result = ContentFinder.Get((icon), true); + return result; } public static Texture2D TryGetTwinsIcon(string path, int babycount) @@ -202,7 +205,10 @@ namespace RJW_Menstruation if (hediffs.Count == 1) return ContentFinder.Get(path + "Womb_Egged_Large", true); else return ContentFinder.Get(path + "Womb_Egged_ManyMixed", true); } - return ContentFinder.Get(path + "Womb_Egged_" + hediffs.Count(), false) ?? ContentFinder.Get(path + "Womb_Egged_Many", true); + Texture2D result = ContentFinder.Get(path + "Womb_Egged_" + hediffs.Count(), false); + if (result == null) result = ContentFinder.Get(path + "Womb_Egged_Many", true); + + return result; } public static Texture2D GetWombIcon(this HediffComp_Menstruation comp) { @@ -301,8 +307,8 @@ namespace RJW_Menstruation public static Texture2D GetAnalIcon(this Pawn pawn, bool drawOrigin = false) { - Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllAnuses.Contains(h.def)) ?? - Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault(h => h.def.defName.ToLower().Contains("anus")); + Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllAnuses.Contains(h.def)); + if (hediff == null) hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault(h => h.def.defName.ToLower().Contains("anus")); if (hediff == null) return ContentFinder.Get(("Genitals/Anal00"), true); string icon; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs index cc1ff7c..a32877c 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs @@ -150,7 +150,8 @@ namespace RJW_Menstruation if (Configurations.EnableBirthVaginaMorph) { // The comp still has the pregnancy attached at this point in the process - Hediff vagina = (__instance.GetMenstruationCompFromPregnancy()?.parent) ?? mother.health.hediffSet.hediffs.FirstOrFallback(x => VariousDefOf.AllVaginas.Contains(x.def)); + Hediff vagina = __instance.GetMenstruationCompFromPregnancy()?.parent; + if (vagina == null) vagina = mother.health.hediffSet.hediffs.FirstOrFallback(x => VariousDefOf.AllVaginas.Contains(x.def)); if (vagina == null) return; float morph = Mathf.Max(baby.BodySize - Mathf.Pow(vagina.Severity * mother.BodySize, 2), 0f); vagina.Severity += morph * Configurations.VaginaMorphPower; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Reflect.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Reflect.cs index 8e55de8..8df18e6 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Reflect.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Reflect.cs @@ -37,14 +37,20 @@ namespace RJW_Menstruation { BindingFlags flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo fieldInfo = type?.GetField(name, flags); - fieldInfo?.SetValue(null, value); + if (fieldInfo != null) + { + fieldInfo.SetValue(null, value); + } } public static void SetMemberValue(this object obj, string name, object value) { BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo fieldInfo = obj?.GetType().GetField(name, flags); - fieldInfo?.SetValue(obj, value); + if (fieldInfo != null) + { + fieldInfo.SetValue(obj, value); + } } diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index af02fef..406a54c 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -66,10 +66,12 @@ namespace RJW_Menstruation public static float GetCumVolume(this Pawn pawn, List hediffs) { - CompHediffBodyPart part = (((hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault()?.TryGetComp()) ?? - (hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault()?.TryGetComp())) ?? - (hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp())) ?? - (hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp()); + CompHediffBodyPart part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + if (part == null) part = hediffs?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + + return pawn.GetCumVolume(part); } @@ -192,8 +194,9 @@ namespace RJW_Menstruation public static void DrawBreastIcon(this Pawn pawn, Rect rect) { - Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def)) ?? - Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_uddersBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def)); + Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def)); + if (hediff == null) + hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_uddersBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def)); Texture2D breast, nipple, areola; if (hediff != null) { @@ -356,15 +359,15 @@ namespace RJW_Menstruation } public static string GetAnusLabel(this Pawn pawn) { - Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllAnuses.Contains(h.def)) ?? - Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault(h => h.def.defName.ToLower().Contains("anus")); + Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllAnuses.Contains(h.def)); + if (hediff == null) hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_anusBPR(pawn)).FirstOrDefault(h => h.def.defName.ToLower().Contains("anus")); if (hediff != null) return hediff.LabelBase.CapitalizeFirst() + "\n(" + hediff.LabelInBrackets + ")"; else return ""; } public static string GetBreastLabel(this Pawn pawn) { - Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def)) ?? - Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_uddersBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def)); + Hediff hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_breastsBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def)); + if (hediff == null) hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_uddersBPR(pawn)).FirstOrDefault(h => VariousDefOf.AllBreasts.Contains(h.def)); if (hediff != null) return hediff.LabelBase.CapitalizeFirst() + "\n(" + hediff.LabelInBrackets + ")"; else return ""; } diff --git a/About/Manifest.xml b/About/Manifest.xml index 5477ddb..015d8cc 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ RJW Menstruation - 1.0.8.7 + 1.0.8.6 diff --git a/changelogs.txt b/changelogs.txt index 46e6221..b2c69dd 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,9 +1,3 @@ -Version 1.0.8.7 - - Fix missing texture when using Milkable Colonists. - - Fix estrus and egg lifespan lasting far longer than intended. - - Canine vaginas now use the new periodic ovulator cycle. - - Hovering over a vagina hediff will show the current state in the tooltip. - Version 1.0.8.6 - Updated Traditional Chinese translation by Hydrogen. - Fix error when trying to terminate a non-Biotech pregnancy.