diff --git a/About/Manifest.xml b/About/Manifest.xml index d6a9b16..2c4f9b0 100644 --- a/About/Manifest.xml +++ b/About/Manifest.xml @@ -1,7 +1,7 @@ RJW Menstruation - 1.0.4.3 + 1.0.4.4 diff --git a/Assemblies/RJW_Menstruation.dll b/Assemblies/RJW_Menstruation.dll index 1ff2f7e..61487c7 100644 Binary files a/Assemblies/RJW_Menstruation.dll and b/Assemblies/RJW_Menstruation.dll differ diff --git a/Defs/Drugs/Pills_Menstruation.xml b/Defs/Drugs/Pills_Menstruation.xml index ed9dca1..0c387ce 100644 --- a/Defs/Drugs/Pills_Menstruation.xml +++ b/Defs/Drugs/Pills_Menstruation.xml @@ -4,7 +4,7 @@ OvaryRegenerationPill - Recovers ovary's health. Less effective on unhealthy ovary. Does not relieve climacteric symptoms. + Recovers ovary's health. Less effective on unhealthy ovary. Does not recover menopause. Things/Item/ORPill Graphic_StackCount diff --git a/Languages/English/Keyed/RJW_Menstruation.xml b/Languages/English/Keyed/RJW_Menstruation.xml index e99f961..d90c195 100644 --- a/Languages/English/Keyed/RJW_Menstruation.xml +++ b/Languages/English/Keyed/RJW_Menstruation.xml @@ -37,7 +37,7 @@ cum decay ratio per hour cum will decrease about this ratio this value affects on the fertility chacne indirectly cum fertility decay ratio per hour - cum will lose fertility about this ratio this value affects on the fertility chance indirectly + cum will lose fertility about this ratio this value affects on the fertility chance indirectly estimated sperm lifespan: cum lose most of fertility at this time. cycle accelerate accelerate menstrution cycle Debug @@ -92,7 +92,8 @@ Open custom hybrid editor. This will overrides hybrid definitions of XML files. Allow shrink icon Let icon become smaller If needed. - + estimated sperm lifespan + Vaginal washing Custom Hybrid Editor diff --git a/Languages/Korean/DefInjected/RecipeDef/BreastSurgeries.xml b/Languages/Korean/DefInjected/RecipeDef/BreastSurgeries.xml new file mode 100644 index 0000000..8c501f4 --- /dev/null +++ b/Languages/Korean/DefInjected/RecipeDef/BreastSurgeries.xml @@ -0,0 +1,15 @@ + + + 유륜확대 수술 + 유륜을 크게만듭니다. + 유륜확대 수술중 + 유륜축소 수술 + 유륜을 작게만듭니다. + 유륜축소 수술중 + 유두확대 수술 + 유두를 크게만듭니다. + 유두확대 수술중 + 유두축소 수술 + 유두를 작게만듭니다. + 유두축소 수술중 + \ No newline at end of file diff --git a/Languages/Korean/DefInjected/ThingDef/RJWMenstruation.xml b/Languages/Korean/DefInjected/ThingDef/RJWMenstruation.xml index b973e40..c48a975 100644 --- a/Languages/Korean/DefInjected/ThingDef/RJWMenstruation.xml +++ b/Languages/Korean/DefInjected/ThingDef/RJWMenstruation.xml @@ -9,7 +9,7 @@ 젖은 생리대 사용된 축축한 생리대입니다. 난소 재생약 - 난소를 재생시켜 배출할수있는 난자의 양을 증가시킵니다. 난자 소모량이 클수록 효과가 줄어듭니다. 갱년기 증상을 완화시키지 않습니다. + 난소를 재생시켜 배출할수있는 난자의 양을 증가시킵니다. 난자 소모량이 클수록 효과가 줄어듭니다. 폐경을 회복시키지 않습니다. 과배란 유도제 과배란을 유도하는 약물입니다. 조기폐경을 초래할수도 있습니다. 진통제 diff --git a/Languages/Korean/Keyed/RJW_Menstruation.xml b/Languages/Korean/Keyed/RJW_Menstruation.xml index b1a2323..2c5d436 100644 --- a/Languages/Korean/Keyed/RJW_Menstruation.xml +++ b/Languages/Korean/Keyed/RJW_Menstruation.xml @@ -37,7 +37,7 @@ 시간당 정액배출비율 이 비율만큼 매 시간마다 정액이 배출됩니다. 시간당 정자 사망비율 - 이 비율만큼 매 시간마다 정자가 사망해 정액이 생식능력을 잃습니다. + 이 비율만큼 매 시간마다 정자가 사망해 정액이 생식능력을 잃습니다. 정자 예상수명: 정액이 대부분의 생식능력을 잃는 시간입니다. 주기 가속 월경주기를 더 빠르게합니다. Debug @@ -92,6 +92,7 @@ 사용자 지정 잡종 편집기를 엽니다. 이 설정은 XML파일의 잡종 정의를 대체합니다. 아이콘 축소 허용 아이콘 축소를 허용합니다. + 정자 예상수명 질세척 diff --git a/MilkModule/Assemblies/MilkModule.dll b/MilkModule/Assemblies/MilkModule.dll index 0694abe..0941445 100644 Binary files a/MilkModule/Assemblies/MilkModule.dll and b/MilkModule/Assemblies/MilkModule.dll differ diff --git a/changelogs.txt b/changelogs.txt index 7076f64..9dd0bcd 100644 --- a/changelogs.txt +++ b/changelogs.txt @@ -1,3 +1,10 @@ +Version 1.0.4.4 + - ovary regeneration pill can restore climacteric (not menopause) + - menstrual blood uses race's blood def + - added estimated sperm lifespan in modsetting + - fixed errors on pregnancy + - changed cum calculation method + Version 1.0.4.3 - fixed errors on pregnancy - added surgeries for nipple/areola diff --git a/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs b/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs index 9aa8acb..a434ed6 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Configurations.cs @@ -177,6 +177,7 @@ namespace RJW_Menstruation base.ExposeData(); } + } @@ -243,6 +244,7 @@ namespace RJW_Menstruation { wombsection.CheckboxLabeled(Translations.Option18_Label, ref Configurations.DrawEggOverlay, Translations.Option18_Desc); } + wombsection.CheckboxLabeled(Translations.Option10_Label, ref Configurations.DrawVaginaStatus, Translations.Option10_Desc); wombsection.CheckboxLabeled(Translations.Option29_Label, ref Configurations.AllowShrinkIcon, Translations.Option29_Desc); if (wombsection.ButtonText(Translations.Option11_Label + ": " + Configurations.LevelString(Configurations.InfoDetail))) @@ -333,7 +335,17 @@ namespace RJW_Menstruation Configurations.CumDecayRatioAdjust = (int)listmain.Slider(Configurations.CumDecayRatioAdjust, 0, 1000); Configurations.CumDecayRatio = (float)Configurations.CumDecayRatioAdjust / 1000; - listmain.Label(Translations.Option6_Label + " " + Configurations.CumFertilityDecayRatio * 100 + "%", -1, Translations.Option6_Desc); + int semenlifespan = (int)(-5 / ((float)Math.Log10((1 - Configurations.CumFertilityDecayRatio)*10) - 1)) + 1; + string estimatedlifespan; + if (semenlifespan < 0) + { + estimatedlifespan = String.Format(": Infinite", semenlifespan); + } + else + { + estimatedlifespan = String.Format(": {0:0}h", semenlifespan); + } + listmain.LabelDouble(Translations.Option6_Label + " " + Configurations.CumFertilityDecayRatio * 100 + "%", Translations.EstimatedCumLifespan + estimatedlifespan, Translations.Option6_Desc); Configurations.CumFertilityDecayRatioAdjust = (int)listmain.Slider(Configurations.CumFertilityDecayRatioAdjust, 0, 1000); Configurations.CumFertilityDecayRatio = (float)Configurations.CumFertilityDecayRatioAdjust / 1000; diff --git a/source/RJW_Menstruation/RJW_Menstruation/Cum.cs b/source/RJW_Menstruation/RJW_Menstruation/Cum.cs index f2e5007..b73645b 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Cum.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Cum.cs @@ -1,5 +1,6 @@ using RimWorld; using System; +using System.Collections.Generic; using UnityEngine; using Verse; @@ -147,7 +148,7 @@ namespace RJW_Menstruation - public void ExposeData() + public virtual void ExposeData() { Scribe_References.Look(ref pawn, "pawn", true); Scribe_Values.Look(ref volume, "volume", volume, true); @@ -158,6 +159,7 @@ namespace RJW_Menstruation Scribe_Values.Look(ref notcumLabel, "notcumLabel", notcumLabel, true); Scribe_Values.Look(ref useCustomColor, "useCustomColor", useCustomColor, true); Scribe_Values.Look(ref customColor, "customColor", customColor, true); + Scribe_Defs.Look(ref filthDef, "filthDef"); } @@ -222,8 +224,51 @@ namespace RJW_Menstruation } + public class CumMixture : Cum, IDisposable + { + protected List cums; + public CumMixture() + { + notcum = true; + cums = new List(); + } + + public CumMixture(Pawn pawn, float volume, List cums, Color color, ThingDef mixtureDef) + { + this.pawn = pawn; + this.volume = volume; + this.cums = cums; + this.customColor = color; + this.useCustomColor = true; + } + + public void Dispose() + { + cums.Clear(); + + } + + public override void ExposeData() + { + base.ExposeData(); + Scribe_Collections.Look(ref cums, "cumslabel", LookMode.Value, new object[0]); + } + + public string GetIngredients() + { + string res = ""; + if (!cums.NullOrEmpty()) for(int i=0; i + /// Force excrete cums in womb and get mixture of cum. + /// + /// + /// + /// + public Cum MixtureOut(ThingDef mixtureDef ,float portion = 0.1f) + { + if (cums.NullOrEmpty()) return null; + Color color = GetCumMixtureColor; + float totalleak = 0; + List cumlabels = new List(); + float cumd = TotalCumPercent; + List removecums = new List(); + foreach (Cum cum in cums) + { + float vd = cum.DismishForce(portion); + string tmp = "FilthLabelWithSource".Translate(cum.FilthDef.label, cum.pawn?.LabelShort ?? "Unknown", 1.ToString()); + cumlabels.Add(tmp.Replace(" x1", "")); + totalleak += vd; + if (cum.ShouldRemove()) removecums.Add(cum); + } + foreach (Cum cum in removecums) + { + cums.Remove(cum); + } + removecums.Clear(); + return new CumMixture(parent.pawn, totalleak, cumlabels, color, mixtureDef); + } - + /// /// Fertilize eggs and return the result /// @@ -761,43 +787,7 @@ namespace RJW_Menstruation if (eggs == null) eggs = new List(); - if (!Configurations.EnableMenopause) - { - RemoveClimactericEffect(); - } - else if (ovarypower < -50000) - { - if (Props.ovaryPower > 10000000) ovarypower = Props.ovaryPower; - else - { - float avglittersize; - try - { - avglittersize = Rand.ByCurveAverage(parent.pawn.def.race.litterSizeCurve); - } - catch (NullReferenceException) - { - avglittersize = 1; - } - ovarypower = (int)(((Props.ovaryPower * Rand.Range(0.7f, 1.3f) * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy) - - (Math.Max(0, parent.pawn.ageTracker.AgeBiologicalYears - RJWSettings.sex_minimum_age * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy)) - * (60 / (Props.folicularIntervalDays + Props.lutealIntervalDays) * Configurations.CycleAcceleration)) * avglittersize); - if (ovarypower < 1) - { - Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn); - hediff.Severity = 0.2f; - parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn)); - curStage = Stage.Young; - } - else if (ovarypower < ovarypowerthreshold) - { - Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Climacteric, parent.pawn); - hediff.Severity = 0.008f * (ovarypowerthreshold - ovarypower); - parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn)); - } - } - } - + InitOvary(parent.pawn.ageTracker.AgeBiologicalYears); if (parent.pawn.IsPregnant()) curStage = Stage.Pregnant; if (parent.pawn.IsAnimal()) @@ -823,6 +813,57 @@ namespace RJW_Menstruation loaded = true; } + protected void InitOvary(int ageYear) + { + if (!Configurations.EnableMenopause) + { + RemoveClimactericEffect(); + } + else if (ovarypower < -50000) + { + if (Props.ovaryPower > 10000000) ovarypower = Props.ovaryPower; + else + { + float avglittersize; + try + { + avglittersize = Rand.ByCurveAverage(parent.pawn.def.race.litterSizeCurve); + } + catch (NullReferenceException) + { + avglittersize = 1; + } + + ovarypower = (int)(((Props.ovaryPower * Utility.RandGaussianLike(0.70f, 1.30f) * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy) + - (Math.Max(0, ageYear - RJWSettings.sex_minimum_age * parent.pawn.def.race.lifeExpectancy / ThingDefOf.Human.race.lifeExpectancy)) + * (60 / (Props.folicularIntervalDays + Props.lutealIntervalDays) * Configurations.CycleAcceleration)) * avglittersize); + if (ovarypower < 1) + { + Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn); + hediff.Severity = 0.2f; + parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn)); + curStage = Stage.Young; + } + else if (ovarypower < ovarypowerthreshold) + { + Hediff hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Climacteric, parent.pawn); + hediff.Severity = 0.008f * (ovarypowerthreshold - ovarypower); + parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn)); + } + } + } + } + + public void RecoverOvary(float multiply = 0.2f) + { + ovarypower = Math.Max(0, (int)(ovarypower * multiply)); + if (ovarypower >= ovarypowerthreshold) + { + RemoveClimactericEffect(); + } + } + + protected void AfterSimulator() { if (Configurations.EnableMenopause && ovarypower < ovarypowerthreshold) @@ -969,7 +1010,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, ThingDefOf.Filth_Blood); + 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); GetNotCum(Translations.Menstrual_Blood).color = BloodColor; } @@ -1116,6 +1157,7 @@ namespace RJW_Menstruation hediff = HediffMaker.MakeHediff(VariousDefOf.Hediff_Menopause, parent.pawn); hediff.Severity = 0.2f; parent.pawn.health.AddHediff(hediff, Genital_Helper.get_genitalsBPR(parent.pawn)); + ovarypower = 0; GoNextStage(Stage.Young); } else if (Configurations.EnableMenopause && ovarypower < ovarypowerthreshold) @@ -1215,7 +1257,14 @@ namespace RJW_Menstruation protected virtual void YoungAction() { - if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) StayCurrentStageConst(Stage.Young); + if (!Configurations.EnableMenopause && ovarypower < 0 && ovarypower > -10000) + { + RemoveClimactericEffect(); + } + if (parent.pawn.health.capacities.GetLevel(xxx.reproduction) <= 0) + { + StayCurrentStageConst(Stage.Young); + } else GoNextStage(Stage.Follicular); } @@ -1277,10 +1326,6 @@ namespace RJW_Menstruation } } - protected virtual void ThoughtCummer() - { - - } private Action PeriodSimulator(Stage targetstage) diff --git a/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs index b5c351d..3155d68 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/HediffComps/MenstruationUtility.cs @@ -5,18 +5,161 @@ using System.Text; using System.Threading.Tasks; using RimWorld; using Verse; - +using rjw; +using UnityEngine; namespace RJW_Menstruation { public static class MenstruationUtility { + public static HediffComp_Menstruation GetMenstruationComp(this Pawn pawn) + { + var hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina")); + HediffComp_Menstruation result; + if (hedifflist.NullOrEmpty()) return null; + else + { + foreach (Hediff h in hedifflist) + { + result = h.TryGetComp(); + if (result != null) return result; + } + } + return null; + } + + public static HediffComp_Menstruation GetMenstruationComp(this Hediff hediff) + { + if (hediff is Hediff_PartBaseNatural || hediff is Hediff_PartBaseArtifical) + { + return hediff.TryGetComp(); + } + return null; + } + public static float GetFertilityChance(this HediffComp_Menstruation comp) { return comp.TotalFertCum * Configurations.FertilizeChance; } - + public static HediffComp_Menstruation.Stage GetCurStage(this Pawn pawn) + { + return GetMenstruationComp(pawn)?.curStage ?? HediffComp_Menstruation.Stage.Bleeding; + } + + + public static Texture2D GetPregnancyIcon(this HediffComp_Menstruation comp, Hediff hediff) + { + string icon = ""; + Texture2D result = null; + int babycount = 1; + if (hediff is Hediff_MechanoidPregnancy) + { + return ContentFinder.Get(("Womb/Mechanoid_Fluid"), true); + } + else if (hediff is Hediff_BasePregnancy) + { + Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff; + babycount = h.babies.Count; + string fetustex = h.babies?.FirstOrDefault()?.def.GetModExtension()?.fetusTexPath ?? "Fetus/Fetus_Default"; + if (h.GestationProgress < 0.2f) icon = comp.wombTex + "_Implanted"; + else if (h.GestationProgress < 0.3f) + { + if (h.babies?.First()?.def?.race?.FleshType == FleshTypeDefOf.Insectoid) icon += "Fetus/Insects/Insect_Early00"; + else icon += "Fetus/Fetus_Early00"; + } + else if (h.GestationProgress < 0.4f) icon += fetustex + "00"; + else if (h.GestationProgress < 0.5f) icon += fetustex + "01"; + else if (h.GestationProgress < 0.6f) icon += fetustex + "02"; + else if (h.GestationProgress < 0.7f) icon += fetustex + "03"; + else if (h.GestationProgress < 0.8f) icon += fetustex + "04"; + else icon += fetustex + "05"; + } + else icon = "Fetus/Slime_Abomi02"; + + result = TryGetTwinsIcon(icon, babycount); + + if (result == null) result = ContentFinder.Get((icon), true); + return result; + } + + public static Texture2D TryGetTwinsIcon(string path, int babycount) + { + Texture2D result = null; + for (int i = babycount; i > 1; i--) + { + result = ContentFinder.Get((path + "_Multiplet_" + i), false); + if (result != null) return result; + } + return null; + } + + public static Texture2D GetCumIcon(this HediffComp_Menstruation comp) + { + string icon = comp.wombTex; + float cumpercent = comp.TotalCumPercent; + if (cumpercent < 0.001f) return ContentFinder.Get("Womb/Empty", true); + else if (cumpercent < 0.01f) icon += "_Cum_00"; + else if (cumpercent < 0.05f) icon += "_Cum_01"; + else if (cumpercent < 0.11f) icon += "_Cum_02"; + else if (cumpercent < 0.17f) icon += "_Cum_03"; + else if (cumpercent < 0.23f) icon += "_Cum_04"; + else if (cumpercent < 0.29f) icon += "_Cum_05"; + else if (cumpercent < 0.35f) icon += "_Cum_06"; + else if (cumpercent < 0.41f) icon += "_Cum_07"; + else if (cumpercent < 0.47f) icon += "_Cum_08"; + else if (cumpercent < 0.53f) icon += "_Cum_09"; + else if (cumpercent < 0.59f) icon += "_Cum_10"; + else if (cumpercent < 0.65f) icon += "_Cum_11"; + else if (cumpercent < 0.71f) icon += "_Cum_12"; + else if (cumpercent < 0.77f) icon += "_Cum_13"; + else if (cumpercent < 0.83f) icon += "_Cum_14"; + 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); + return cumtex; + } + + public static Texture2D GetWombIcon(this HediffComp_Menstruation comp) + { + if (comp.Pawn.health.hediffSet.GetHediffs().FirstOrDefault() != null) return ContentFinder.Get(("Womb/Womb_Egged"), true); + string icon = comp.wombTex; + HediffComp_Menstruation.Stage stage = comp.curStage; + if (stage == HediffComp_Menstruation.Stage.Bleeding) icon += "_Bleeding"; + + Texture2D wombtex = ContentFinder.Get((icon), true); + + return wombtex; + } + public static Texture2D GetEggIcon(this HediffComp_Menstruation comp) + { + if (comp.parent.pawn.IsPregnant()) + { + if (comp.parent.pawn.GetPregnancyProgress() < 0.2f) return ContentFinder.Get("Eggs/Egg_Implanted00", true); + else return ContentFinder.Get("Womb/Empty", true); + } + else if (!comp.IsEggExist) return ContentFinder.Get("Womb/Empty", true); + else + { + int fertstage = comp.IsFertilized; + if (fertstage >= 0) + { + if (fertstage < 1) return ContentFinder.Get("Eggs/Egg_Fertilized00", true); + else if (fertstage < 24) return ContentFinder.Get("Eggs/Egg_Fertilized01", true); + else return ContentFinder.Get("Eggs/Egg_Fertilized02", true); + } + else if (comp.IsEggFertilizing) return ContentFinder.Get("Eggs/Egg_Fertilizing01", true); + else return ContentFinder.Get("Eggs/Egg", true); + } + } + + public static void DrawEggOverlay(this HediffComp_Menstruation comp, Rect wombRect) + { + Rect rect = new Rect(wombRect.xMax - wombRect.width / 3, wombRect.y, wombRect.width / 3, wombRect.width / 3); + GUI.color = Color.white; + GUI.DrawTexture(rect, comp.GetEggIcon(), ScaleMode.ScaleToFit); + } } } diff --git a/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs b/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs index 0d67dcd..2524217 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Hediff_MultiplePregnancy.cs @@ -206,12 +206,12 @@ namespace RJW_Menstruation { if (xxx.is_human(father)) { - melanin = (mother.story.melanin + father.story.melanin) / 2; + melanin = (mother.story?.melanin ?? 0f + father.story?.melanin ?? 0f) / 2; lastname = NameTriple.FromString(father.Name.ToStringFull).Last; } else { - melanin = mother.story.melanin; + melanin = mother.story?.melanin ?? 0f; lastname = NameTriple.FromString(mother.Name.ToStringFull).Last; } @@ -220,7 +220,7 @@ namespace RJW_Menstruation { if (xxx.is_human(father)) { - melanin = father.story.melanin; + melanin = father.story?.melanin ?? 0f; lastname = NameTriple.FromString(father.Name.ToStringFull).Last; } else @@ -410,10 +410,10 @@ namespace RJW_Menstruation string MotherRaceName = ""; string FatherRaceName = ""; - MotherRaceName = mother.kindDef.race.defName; + MotherRaceName = mother.kindDef?.race?.defName; PawnKindDef tmp = spawn_kind_def; if (father != null) - FatherRaceName = father.kindDef.race.defName; + FatherRaceName = father.kindDef?.race?.defName; if (FatherRaceName != "" && Configurations.UseHybridExtention) @@ -458,7 +458,7 @@ namespace RJW_Menstruation } else if (!Configurations.UseHybridExtention || spawn_kind_def == null) { - spawn_kind_def = mother.RaceProps.AnyPawnKind; + spawn_kind_def = mother.RaceProps?.AnyPawnKind ?? mother.kindDef; } if (spawn_kind_def.defName.Contains("Nymph")) @@ -476,7 +476,7 @@ namespace RJW_Menstruation if (spawn_kind_def_list.NullOrEmpty()) spawn_kind_def = PawnKindDefOf.Colonist; - spawn_kind_def = spawn_kind_def_list.RandomElement(); + if (!spawn_kind_def_list.NullOrEmpty()) spawn_kind_def = spawn_kind_def_list.RandomElement(); } diff --git a/source/RJW_Menstruation/RJW_Menstruation/JobDrivers.cs b/source/RJW_Menstruation/RJW_Menstruation/JobDrivers.cs index bdca9a4..e28a9f6 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/JobDrivers.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/JobDrivers.cs @@ -17,7 +17,7 @@ namespace RJW_Menstruation protected override IEnumerable MakeNewToils() { - HediffComp_Menstruation Comp = Utility.GetMenstruationComp(pawn); + HediffComp_Menstruation Comp = pawn.GetMenstruationComp(); this.FailOn(delegate { return !(Comp.TotalCumPercent > 0.001); diff --git a/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs b/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs index d0dc558..a602aeb 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Patch/GetGizmos.cs @@ -56,7 +56,7 @@ namespace RJW_Menstruation Hediff hediff = PregnancyHelper.GetPregnancy(pawn); if (Utility.ShowFetusImage((Hediff_BasePregnancy)hediff)) { - icon = Utility.GetPregnancyIcon(comp, hediff); + icon = comp.GetPregnancyIcon(hediff); if (hediff is Hediff_BasePregnancy) { Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff; diff --git a/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs b/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs index c3bed0a..3c606f2 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Patch/RJW_Patch.cs @@ -35,7 +35,7 @@ namespace RJW_Menstruation else return true; if (female.IsAnimal() && !Configurations.EnableAnimalCycle) return true; - HediffComp_Menstruation comp = Utility.GetMenstruationComp(female); + HediffComp_Menstruation comp = female.GetMenstruationComp(); if (comp != null) { if (Genital_Helper.has_penis_fertile(male, maleparts) && PregnancyHelper.CanImpregnate(male, female, sextype)) @@ -47,10 +47,9 @@ namespace RJW_Menstruation { comp.CumIn(male, Rand.Range(0.5f,3.0f) * RJWSettings.cum_on_body_amount_adjust * male.BodySize, 1.0f); } - else comp.CumIn(male, male.GetCumVolume(), 0); + else comp.CumIn(male, male.GetCumVolume(maleparts), 0); } - //if (Genital_Helper.has_vagina(partner, partnerparts)) //{ // if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true; diff --git a/source/RJW_Menstruation/RJW_Menstruation/Translations.cs b/source/RJW_Menstruation/RJW_Menstruation/Translations.cs index ce80922..8e211a1 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Translations.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Translations.cs @@ -99,6 +99,8 @@ namespace RJW_Menstruation public static readonly string Option29_Label = "Option29_Label".Translate(); public static readonly string Option29_Desc = "Option29_Desc".Translate(); + public static readonly string EstimatedCumLifespan = "EstimatedCumLifespan".Translate(); + public static readonly string FloatMenu_CleanSelf = "FloatMenu_CleanSelf".Translate(); public static readonly string CustomHybrid_List_Title = "CustomHybrid_List_Title".Translate(); diff --git a/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs b/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs index 5cf20f8..5d5a952 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/UI/Dialog_WombStatus.cs @@ -44,7 +44,7 @@ namespace RJW_Menstruation get { float width = 450f + 2 * windowMargin; - float height = 820f; + float height = 780f + 2 * windowMargin; if (!Configurations.DrawWombStatus) height -= wombRectHeight; if (!Configurations.DrawVaginaStatus || pawn.IsAnimal()) width -= 150f; return new Vector2(width, height); @@ -132,7 +132,7 @@ namespace RJW_Menstruation Hediff hediff = PregnancyHelper.GetPregnancy(pawn); if (pregnant && Utility.ShowFetusImage((Hediff_BasePregnancy)hediff)) { - womb = Utility.GetPregnancyIcon(comp, hediff); + womb = comp.GetPregnancyIcon(hediff); if (hediff is Hediff_MultiplePregnancy) { Hediff_MultiplePregnancy h = (Hediff_MultiplePregnancy)hediff; @@ -297,6 +297,7 @@ namespace RJW_Menstruation //Widgets.DrawTextureFitted(wombRect, cum,1.0f); GUI.DrawTexture(rect, womb, ScaleMode.ScaleToFit, true, 0, Color.white, 0, 0); GUI.DrawTexture(rect, cum, ScaleMode.ScaleToFit, true, 0, cumcolor, 0, 0); + GUI.color = Color.white; @@ -378,12 +379,11 @@ namespace RJW_Menstruation statvalue = pawn.records.GetValue(xxx.CountOfWhore); if (statvalue > 0) { - FillableBarLabeled(lineRect, " " + xxx.CountOfWhore.LabelCap.CapitalizeFirst() + " " + statvalue, statvalue / 500, TextureCache.slaaneshTexture, Texture2D.blackTexture); + FillableBarLabeled(lineRect, " " + xxx.CountOfWhore.LabelCap.CapitalizeFirst() + " " + statvalue, statvalue / 50, TextureCache.slaaneshTexture, Texture2D.blackTexture); statvalue = pawn.records.GetValue(xxx.EarnedMoneyByWhore); lineRect.y += height; FillableBarLabeled(lineRect, " " + VariousDefOf.RJW_EarnedMoneyByWhore.label.CapitalizeFirst() + " " + statvalue, statvalue / 10000, TextureCache.ghalmarazTexture, Texture2D.blackTexture); - lineRect.y += height; } else diff --git a/source/RJW_Menstruation/RJW_Menstruation/Utility.cs b/source/RJW_Menstruation/RJW_Menstruation/Utility.cs index b136a9c..0cb60d0 100644 --- a/source/RJW_Menstruation/RJW_Menstruation/Utility.cs +++ b/source/RJW_Menstruation/RJW_Menstruation/Utility.cs @@ -56,15 +56,30 @@ namespace RJW_Menstruation public static float GetCumVolume(this Pawn pawn) { - CompHediffBodyPart part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("penis")).InRandomOrder().FirstOrDefault()?.TryGetComp(); - if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorf")).InRandomOrder().FirstOrDefault()?.TryGetComp(); - if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("ovipositorm")).InRandomOrder().FirstOrDefault()?.TryGetComp(); - if (part == null) part = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff hed) => hed.def.defName.ToLower().Contains("tentacle")).InRandomOrder().FirstOrDefault()?.TryGetComp(); + List hediffs = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)); + if (hediffs.NullOrEmpty()) return 0; + else return pawn.GetCumVolume(hediffs); + } + + public static float GetCumVolume(this Pawn pawn, List hediffs) + { + 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); + } + + + public static float GetCumVolume(this Pawn pawn, CompHediffBodyPart part) + { + float res; - float res = 0; try { - res = part.FluidAmmount * part.FluidModifier * pawn.BodySize * Rand.Range(0.8f, 1.2f) * RJWSettings.cum_on_body_amount_adjust * 0.3f; + res = part.FluidAmmount * part.FluidModifier * pawn.BodySize / pawn.RaceProps.baseBodySize * Rand.Range(0.8f, 1.2f) * RJWSettings.cum_on_body_amount_adjust * 0.3f; } catch (NullReferenceException) { @@ -76,30 +91,6 @@ namespace RJW_Menstruation } - public static HediffComp_Menstruation GetMenstruationComp(this Pawn pawn) - { - var hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina")); - HediffComp_Menstruation result; - if (hedifflist.NullOrEmpty()) return null; - else - { - foreach (Hediff h in hedifflist) - { - result = h.TryGetComp(); - if (result != null) return result; - } - } - return null; - } - - public static HediffComp_Menstruation GetMenstruationComp(this Hediff hediff) - { - if (hediff is Hediff_PartBaseNatural || hediff is Hediff_PartBaseArtifical) - { - return hediff.TryGetComp(); - } - return null; - } public static HediffComp_Breast GetBreastComp(this Pawn pawn) { @@ -158,12 +149,6 @@ namespace RJW_Menstruation } - public static HediffComp_Menstruation.Stage GetCurStage(this Pawn pawn) - { - return GetMenstruationComp(pawn)?.curStage ?? HediffComp_Menstruation.Stage.Bleeding; - } - - public static float GetPregnancyProgress(this Pawn pawn) { Hediff hediff = PregnancyHelper.GetPregnancy(pawn); @@ -194,93 +179,6 @@ namespace RJW_Menstruation return null; } - - - public static Texture2D GetPregnancyIcon(HediffComp_Menstruation comp, Hediff hediff) - { - string icon = ""; - Texture2D result = null; - int babycount = 1; - if (hediff is Hediff_MechanoidPregnancy) - { - return ContentFinder.Get(("Womb/Mechanoid_Fluid"), true); - } - else if (hediff is Hediff_BasePregnancy) - { - Hediff_BasePregnancy h = (Hediff_BasePregnancy)hediff; - babycount = h.babies.Count; - string fetustex = h.babies?.FirstOrDefault()?.def.GetModExtension()?.fetusTexPath ?? "Fetus/Fetus_Default"; - if (h.GestationProgress < 0.2f) icon = comp.wombTex + "_Implanted"; - else if (h.GestationProgress < 0.3f) - { - if (h.babies?.First()?.def?.race?.FleshType == FleshTypeDefOf.Insectoid) icon += "Fetus/Insects/Insect_Early00"; - else icon += "Fetus/Fetus_Early00"; - } - else if (h.GestationProgress < 0.4f) icon += fetustex + "00"; - else if (h.GestationProgress < 0.5f) icon += fetustex + "01"; - else if (h.GestationProgress < 0.6f) icon += fetustex + "02"; - else if (h.GestationProgress < 0.7f) icon += fetustex + "03"; - else if (h.GestationProgress < 0.8f) icon += fetustex + "04"; - else icon += fetustex + "05"; - } - else icon = "Fetus/Slime_Abomi02"; - - result = TryGetTwinsIcon(icon, babycount); - - if (result == null) result = ContentFinder.Get((icon), true); - return result; - } - - public static Texture2D TryGetTwinsIcon(string path, int babycount) - { - Texture2D result = null; - for (int i = babycount; i>1; i--) - { - result = ContentFinder.Get((path + "_Multiplet_" + i), false); - if (result != null) return result; - } - return null; - } - - public static Texture2D GetCumIcon(this HediffComp_Menstruation comp) - { - string icon = comp.wombTex; - float cumpercent = comp.TotalCumPercent; - if (cumpercent < 0.001f) return ContentFinder.Get("Womb/Empty", true); - else if (cumpercent < 0.01f) icon += "_Cum_00"; - else if (cumpercent < 0.05f) icon += "_Cum_01"; - else if (cumpercent < 0.11f) icon += "_Cum_02"; - else if (cumpercent < 0.17f) icon += "_Cum_03"; - else if (cumpercent < 0.23f) icon += "_Cum_04"; - else if (cumpercent < 0.29f) icon += "_Cum_05"; - else if (cumpercent < 0.35f) icon += "_Cum_06"; - else if (cumpercent < 0.41f) icon += "_Cum_07"; - else if (cumpercent < 0.47f) icon += "_Cum_08"; - else if (cumpercent < 0.53f) icon += "_Cum_09"; - else if (cumpercent < 0.59f) icon += "_Cum_10"; - else if (cumpercent < 0.65f) icon += "_Cum_11"; - else if (cumpercent < 0.71f) icon += "_Cum_12"; - else if (cumpercent < 0.77f) icon += "_Cum_13"; - else if (cumpercent < 0.83f) icon += "_Cum_14"; - 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); - return cumtex; - } - - public static Texture2D GetWombIcon(this HediffComp_Menstruation comp) - { - if (comp.Pawn.health.hediffSet.GetHediffs().FirstOrDefault() != null) return ContentFinder.Get(("Womb/Womb_Egged"), true); - string icon = comp.wombTex; - HediffComp_Menstruation.Stage stage = comp.curStage; - if (stage == HediffComp_Menstruation.Stage.Bleeding) icon += "_Bleeding"; - - Texture2D wombtex = ContentFinder.Get((icon), true); - - return wombtex; - } - public static Texture2D GetGenitalIcon(this Pawn pawn) { var hediff = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.Find((Hediff h) => h.def.defName.ToLower().Contains("vagina")); @@ -543,35 +441,6 @@ namespace RJW_Menstruation } } - public static void DrawEggOverlay(this HediffComp_Menstruation comp, Rect wombRect) - { - Rect rect = new Rect(wombRect.xMax - wombRect.width / 3, wombRect.y, wombRect.width / 3, wombRect.width / 3); - GUI.color = Color.white; - GUI.DrawTexture(rect, comp.GetEggIcon(), ScaleMode.ScaleToFit); - } - - public static Texture2D GetEggIcon(this HediffComp_Menstruation comp) - { - if (comp.parent.pawn.IsPregnant()) - { - if (comp.parent.pawn.GetPregnancyProgress() < 0.2f) return ContentFinder.Get("Eggs/Egg_Implanted00", true); - else return ContentFinder.Get("Womb/Empty", true); - } - else if (!comp.IsEggExist) return ContentFinder.Get("Womb/Empty", true); - else - { - int fertstage = comp.IsFertilized; - if (fertstage >= 0) - { - if (fertstage < 1) return ContentFinder.Get("Eggs/Egg_Fertilized00", true); - else if (fertstage < 24) return ContentFinder.Get("Eggs/Egg_Fertilized01", true); - else return ContentFinder.Get("Eggs/Egg_Fertilized02", true); - } - else if (comp.IsEggFertilizing) return ContentFinder.Get("Eggs/Egg_Fertilizing01", true); - else return ContentFinder.Get("Eggs/Egg", true); - } - } - public static float RandGaussianLike(float min, float max, int iterations = 3) { double res = 0;