diff --git a/1.4/Assemblies/RJW_Menstruation.dll b/1.4/Assemblies/RJW_Menstruation.dll new file mode 100644 index 0000000..c63cdd9 Binary files /dev/null and b/1.4/Assemblies/RJW_Menstruation.dll differ diff --git a/1.4/Assemblies/RJW_Menstruation.dll.config b/1.4/Assemblies/RJW_Menstruation.dll.config new file mode 100644 index 0000000..4bfa005 --- /dev/null +++ b/1.4/Assemblies/RJW_Menstruation.dll.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/1.4/MilkModule/Assemblies/MilkModule.dll b/1.4/MilkModule/Assemblies/MilkModule.dll new file mode 100644 index 0000000..451e5c1 Binary files /dev/null and b/1.4/MilkModule/Assemblies/MilkModule.dll differ diff --git a/1.4/source/RJW_Menstruation/MilkModule/MilkModule.csproj b/1.4/source/RJW_Menstruation/MilkModule/MilkModule.csproj index b8a0004..646ba34 100644 --- a/1.4/source/RJW_Menstruation/MilkModule/MilkModule.csproj +++ b/1.4/source/RJW_Menstruation/MilkModule/MilkModule.csproj @@ -9,9 +9,10 @@ Properties MilkModule MilkModule - v4.7.2 + v4.8 512 true + true @@ -94,8 +95,9 @@ - 2.1.1 - runtime + 2.2.2 + runtime + compile; build; native; contentfiles; analyzers; buildtransitive diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/App.config b/1.4/source/RJW_Menstruation/RJW_Menstruation/App.config index 56efbc7..4bfa005 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/App.config +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/App.config @@ -1,6 +1,6 @@ - + - + - \ No newline at end of file + 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 84d1f62..7ef52c7 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Compatibility/HARCompatibility.cs @@ -19,7 +19,6 @@ namespace RJW_Menstruation AlienPartGenerator.AlienComp babyHARComp = baby?.TryGetComp(); AlienPartGenerator.AlienComp originalHARComp = original?.TryGetComp(); if (babyHARComp == null || originalHARComp == null) return; - babyHARComp.crownType = originalHARComp.crownType; foreach(KeyValuePair> channel in originalHARComp.ColorChannels) { diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs index e7eaf60..f74685f 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/HediffComp_Breast.cs @@ -213,8 +213,11 @@ namespace RJW_Menstruation if ((Pawn.relations == null)) return youngestAge; + List pregnancies = new List(); + Pawn.health.hediffSet.GetHediffs(ref pregnancies); + bool hasChild = Pawn.relations.Children. - Where(child => !Pawn.health.hediffSet.GetHediffs().Any(preg => preg.babies.Contains(child))). // no fetuses + Where(child => !pregnancies.Any(preg => preg.babies.Contains(child))). // no fetuses Where(child => child.GetMother() == Pawn). // not Dad TryMinBy(child => child.ageTracker.AgeBiologicalTicks, out Pawn youngest); 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 ebae09e..4fc30f6 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 @@ -1223,7 +1223,7 @@ namespace RJW_Menstruation deadeggs.Add(egg); continue; } - else if (Pawn.health.hediffSet.GetHediffs().Any() || pregnancy is Hediff_MechanoidPregnancy) + else if (Pawn.health.hediffSet.GetFirstHediff() != null || pregnancy is Hediff_MechanoidPregnancy) { if (Configurations.Debug) Log.Message($"Could not implant {Pawn}'s egg due to insect or mechanoid pregnancy"); deadeggs.Add(egg); @@ -1257,7 +1257,9 @@ namespace RJW_Menstruation if (Configurations.Debug) Log.Message($"Creating new base RJW pregnancy"); PregnancyHelper.PregnancyDecider(Pawn, egg.fertilizer); // I hate having to do this, but it gets the newest pregnancy - pregnancy = Pawn.health.hediffSet.GetHediffs().MaxBy(hediff => hediff.loadID); + List pregnancies = new List(); + Pawn.health.hediffSet.GetHediffs(ref pregnancies); + pregnancy = pregnancies.MaxBy(hediff => hediff.loadID); pregnant = true; break; } @@ -1754,8 +1756,11 @@ namespace RJW_Menstruation { if (pregnancy != null) return; + List pregnancies = new List(); + Pawn.health.hediffSet.GetHediffs(ref pregnancies); + pregnancy = - Pawn.health.hediffSet.GetHediffs().Except( + pregnancies.Except( Pawn.GetMenstruationComps().Select(comp => comp.pregnancy).Where(preg => preg != null) ).FirstOrDefault(); if (pregnancy != null) 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 10b78a1..3190463 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -158,7 +158,9 @@ namespace RJW_Menstruation } public static Texture2D GetInsectEggedIcon(this HediffComp_Menstruation comp) { - List hediffs = comp.Pawn.health.hediffSet.GetHediffs().ToList(); + List hediffs = new List(); + comp.Pawn.health.hediffSet.GetHediffs(ref hediffs); + if (hediffs.NullOrEmpty()) return null; string path = "Womb/Insect_Egged/"; if (hediffs.Max(hediff => hediff.eggssize) > 0.3) // The threshold for "large egg" in the debug 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 0f4123c..3c284e3 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -375,34 +375,34 @@ namespace RJW_Menstruation public bool AddNewBaby(Pawn mother, Pawn father) { - float melanin; + //float melanin; string lastname; if (xxx.is_human(mother)) { if (xxx.is_human(father)) { - melanin = ChildRelationUtility.GetRandomChildSkinColor(father.story?.melanin ?? 0f, mother.story?.melanin ?? 0f); + //melanin = ChildRelationUtility.GetRandomChildSkinColor(father.story?.melanin ?? 0f, mother.story?.melanin ?? 0f); //melanin = (mother.story?.melanin ?? 0f + father.story?.melanin ?? 0f) / 2; } else { - melanin = mother.story?.melanin ?? 0f; + //melanin = mother.story?.melanin ?? 0f; } lastname = NameTriple.FromString(mother.Name.ToStringFull).Last; } else if (xxx.is_human(father)) { - melanin = father.story?.melanin ?? 0f; + //melanin = father.story?.melanin ?? 0f; lastname = NameTriple.FromString(father.Name.ToStringFull).Last; } else { - melanin = Rand.Range(0, 1.0f); + //melanin = Rand.Range(0, 1.0f); lastname = ""; } PawnGenerationRequest request = new PawnGenerationRequest( - newborn: true, + developmentalStages: DevelopmentalStage.Newborn, allowDowned: true, faction: mother.Faction, canGeneratePawnRelations: false, @@ -411,7 +411,7 @@ namespace RJW_Menstruation allowFood: false, allowAddictions: false, relationWithExtraPawnChanceFactor: 0, - fixedMelanin: melanin, + //fixedMelanin: melanin, fixedLastName: lastname, kind: BabyPawnKindDecider(mother, father), //fixedIdeo: mother.Ideo, @@ -421,7 +421,7 @@ namespace RJW_Menstruation int division = 1; Pawn firstbaby = null; - string firstheadpath = null; + //string firstheadpath = null; int traitSeed = Rand.Int; List parentTraits = GetInheritableTraits(mother, father); while (Rand.Chance(Configurations.EnzygoticTwinsChance) && division < Configurations.MaxEnzygoticTwins) division++; @@ -438,13 +438,13 @@ namespace RJW_Menstruation if (baby.story != null) { - firstheadpath = (string)baby.story.GetMemberValue("headGraphicPath"); - if (firstheadpath == null) - { - Graphic_Multi head = GraphicDatabaseHeadRecords.GetHeadRandom(baby.gender, baby.story.SkinColor, baby.story.crownType, true); - if (head != null) baby.story.SetMemberValue("headGraphicPath", head.GraphicPath); - firstheadpath = (string)baby.story.GetMemberValue("headGraphicPath"); - } + // firstheadpath = (string)baby.story.GetMemberValue("headGraphicPath"); + // if (firstheadpath == null) + // { + // Graphic_Multi head = GraphicDatabaseHeadRecords.GetHeadRandom(baby.gender, baby.story.SkinColor, baby.story.crownType, true); + // if (head != null) baby.story.SetMemberValue("headGraphicPath", head.GraphicPath); + // firstheadpath = (string)baby.story.GetMemberValue("headGraphicPath"); + // } } } else @@ -454,16 +454,16 @@ namespace RJW_Menstruation if (baby.story != null) { baby.story.hairDef = firstbaby.story.hairDef; - baby.story.hairColor = firstbaby.story.hairColor; + //baby.story.hairColor = firstbaby.story.hairColor; baby.story.bodyType = firstbaby.story.bodyType; - baby.story.crownType = firstbaby.story.crownType; - baby.story.SetMemberValue("headGraphicPath", firstheadpath); + //baby.story.crownType = firstbaby.story.crownType; + //baby.story.SetMemberValue("headGraphicPath", firstheadpath); } if (baby.IsHAR()) HARCompatibility.CopyHARProperties(baby, firstbaby); - if (Configurations.AnimalGeneticsActivated) - AnimalGeneticsCompatibility.CopyGenes(baby, firstbaby); + //if (Configurations.AnimalGeneticsActivated) + //AnimalGeneticsCompatibility.CopyGenes(baby, firstbaby); } } babies.Add(baby); @@ -475,9 +475,9 @@ namespace RJW_Menstruation public Pawn GenerateBaby(PawnGenerationRequest request, Pawn mother, Pawn father, List parentTraits, int traitSeed) { - if (Configurations.AnimalGeneticsActivated) AnimalGeneticsCompatibility.PreConception(mother, father); + //if (Configurations.AnimalGeneticsActivated) AnimalGeneticsCompatibility.PreConception(mother, father); Pawn baby = PawnGenerator.GeneratePawn(request); - if (Configurations.AnimalGeneticsActivated) AnimalGeneticsCompatibility.PostConception(); + //if (Configurations.AnimalGeneticsActivated) AnimalGeneticsCompatibility.PostConception(); if (baby == null) { Log.Error("Baby not generated. Request: " + request.ToString()); diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs index 7c8ab75..8c71bf4 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs @@ -78,7 +78,7 @@ namespace RJW_Menstruation } else { - Hediff hediff = pawn.health.hediffSet.GetHediffs().FirstOrDefault(); + Hediff hediff = pawn.health.hediffSet.GetFirstHediff(); if (hediff != null) { icon = MenstruationUtility.GetInsectEggedIcon(comp); @@ -103,7 +103,7 @@ namespace RJW_Menstruation shrinkable = Configurations.AllowShrinkIcon, cumcolor = c, comp = comp, - order = 100, + //order = 100, hotKey = comp == pawn.GetFirstMenstruationComp() ? VariousDefOf.OpenStatusWindowKey : null, groupKey = 0, action = delegate 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 82490e4..b2e1ee9 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 @@ -53,7 +53,7 @@ namespace RJW_Menstruation { Pawn pawn = props.partner; - if (props.sexType != xxx.rjwSextype.MechImplant && !pawn.health.hediffSet.GetHediffs().Any()) return; + if (props.sexType != xxx.rjwSextype.MechImplant && pawn.health.hediffSet.GetFirstHediff() == null) return; // The existing pregnancies might have been destroyed, so go through see if any new mech pregnancies need to be picked up foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps()) 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 ac3d501..35f0a1c 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/RJW_Menstruation.csproj @@ -8,7 +8,7 @@ Library RJW_Menstruation RJW_Menstruation - v4.7.2 + v4.8 512 true true @@ -27,6 +27,7 @@ false false true + AnyCPU diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Gizmo_Womb.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Gizmo_Womb.cs index 221ca72..c303d4e 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Gizmo_Womb.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/UI/Gizmo_Womb.cs @@ -13,7 +13,7 @@ namespace RJW_Menstruation public override void DrawIcon(Rect rect, Material buttonMat, GizmoRenderParms parms) { - Texture2D badTex = icon; + Texture badTex = icon; Texture2D overay = icon_overay; Color color = cumcolor; diff --git a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index 4a0e65e..499c84b 100644 --- a/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/1.4/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -138,12 +138,14 @@ namespace RJW_Menstruation public static bool IsRJWPregnant(this Pawn pawn) { - return pawn.health.hediffSet.GetHediffs().Any(); + return pawn.health.hediffSet.GetFirstHediff() != null; } public static float GetFarthestPregnancyProgress(this Pawn pawn) { - return pawn.health.hediffSet.GetHediffs().MaxByWithFallback(hediff => hediff.GestationProgress)?.GestationProgress ?? 0; + List pregnancies = new List(); + pawn.health.hediffSet.GetHediffs(ref pregnancies); + return pregnancies.MaxByWithFallback(hediff => hediff.GestationProgress)?.GestationProgress ?? 0; } public static float GetPregnancyProgress(this HediffComp_Menstruation comp)