Compare commits

..

1 commit

Author SHA1 Message Date
Naz
fb275e6d55 Merge branch 'main' into 'main'
Korean Translation

See merge request lutepickle/rjw_menstruation!3
2023-03-21 21:57:58 +00:00
27 changed files with 429 additions and 614 deletions

Binary file not shown.

View file

@ -37,8 +37,7 @@
<Option7_Label>月經加速</Option7_Label> <Option7_Label>月經加速</Option7_Label>
<Option7_Desc>加快月經週期</Option7_Desc> <Option7_Desc>加快月經週期</Option7_Desc>
<Option8_Label>除錯</Option8_Label> <Option8_Label>除錯</Option8_Label>
<Option8_Desc>顯示除錯資訊 <Option8_Desc>顯示除錯資訊&#10;啟用時會令「胎兒信息級別」選項調至「全部細節」。</Option8_Desc>
啟用時會令「胎兒信息級別」選項調至「全部細節」。</Option8_Desc>
<Option9_Label>子宮狀態</Option9_Label> <Option9_Label>子宮狀態</Option9_Label>
<Option9_Desc>在狀態窗口中繪製子宮圖標</Option9_Desc> <Option9_Desc>在狀態窗口中繪製子宮圖標</Option9_Desc>
<Option10_Label>陰道狀態</Option10_Label> <Option10_Label>陰道狀態</Option10_Label>
@ -148,10 +147,4 @@
<CannotNoEggs>沒有卵細胞</CannotNoEggs> <CannotNoEggs>沒有卵細胞</CannotNoEggs>
<CannotNoWomb>必須擁有子宮</CannotNoWomb> <CannotNoWomb>必須擁有子宮</CannotNoWomb>
<EggRestorationCompleted>{PAWN_labelShort}完成了{PAWN_possessive}卵母細胞再生術(cycle)</EggRestorationCompleted> <EggRestorationCompleted>{PAWN_labelShort}完成了{PAWN_possessive}卵母細胞再生術(cycle)</EggRestorationCompleted>
<!--Auto generated: Tue Apr 11 17:51:09 2023-->
<OvulationChanceLabel>排卵機率:{0}</OvulationChanceLabel>
<OvulationChanceDesc>排卵期內每個卵子的獨立排卵機率。</OvulationChanceDesc>
<Option_EnableBiotechTwins_Label>(測試中!) 允許在「生機」(Biotech)追加的懷孕機制中出現多胞胎。</Option_EnableBiotechTwins_Label>
<Option_EnableBiotechTwins_Desc>啟用這個選項將允許同卵或異卵雙胞胎出現在「生機」(Biotech)追加的懷孕機制中。
一併將啟用雜交系統;然而兩個類人(humanlikes)生物絕不可能生出動物。</Option_EnableBiotechTwins_Desc>
</LanguageData> </LanguageData>

View file

@ -56,12 +56,6 @@
<Option6_Desc>Cum will lose fertility by this amount every hour&#10;This value affects fertilization chance indirectly.</Option6_Desc> <Option6_Desc>Cum will lose fertility by this amount every hour&#10;This value affects fertilization chance indirectly.</Option6_Desc>
<Option7_Label>Cycle acceleration</Option7_Label> <Option7_Label>Cycle acceleration</Option7_Label>
<Option7_Desc>Accelerate menstruation cycle&#10;This can cause early menopause and infertility.&#10;Setting this lower than x12 is recommended.&#10;Rimworld's timescale: x6(default)</Option7_Desc> <Option7_Desc>Accelerate menstruation cycle&#10;This can cause early menopause and infertility.&#10;Setting this lower than x12 is recommended.&#10;Rimworld's timescale: x6(default)</Option7_Desc>
<Option_ColonistUpdateInterval_Label>Colonist update interval</Option_ColonistUpdateInterval_Label>
<Option_ColonistUpdateInterval_Desc>How often the womb of each of your colonists, prisoners, and slaves update.&#10;Lowering this will improve accuracy, increasing this can improve performance.</Option_ColonistUpdateInterval_Desc>
<Option_NonColonistUpdateInterval_Label>Non-colonist update interval</Option_NonColonistUpdateInterval_Label>
<Option_NonColonistUpdateInterval_Desc>How often the womb of humans you don't control update.&#10;Lowering this will improve accuracy, increasing this can improve performance.</Option_NonColonistUpdateInterval_Desc>
<Option_AnimalUpdateInterval_Label>Animal update interval</Option_AnimalUpdateInterval_Label>
<Option_AnimalUpdateInterval_Desc>How often the womb of animals update.&#10;Lowering this will improve accuracy, increasing this can improve performance.</Option_AnimalUpdateInterval_Desc>
<Option8_Label>Debug</Option8_Label> <Option8_Label>Debug</Option8_Label>
<Option8_Desc>Show debug information.</Option8_Desc> <Option8_Desc>Show debug information.</Option8_Desc>
<Option9_Label>Womb status</Option9_Label> <Option9_Label>Womb status</Option9_Label>

View file

@ -1,5 +1,4 @@
using RimWorld; using rjw;
using rjw;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@ -18,10 +17,6 @@ namespace RJW_Menstruation
public const float CumFertilityDecayRatioDefault = 0.05f; public const float CumFertilityDecayRatioDefault = 0.05f;
public const int CumFertilityDecayRatioAdjustDefault = 50; public const int CumFertilityDecayRatioAdjustDefault = 50;
public const int CycleAccelerationDefault = 6; public const int CycleAccelerationDefault = 6;
public const int ColonistTickIntervalDefault = 2500; // 1 hour
public const int NonColonistTickIntervalDefault = 2500;
public const int AnimalTickIntervalDefault = 2500;
public const int TickIntervalMinimum = 20;
public const float EnzygoticTwinsChanceDefault = 0.002f; public const float EnzygoticTwinsChanceDefault = 0.002f;
public const int EnzygoticTwinsChanceAdjustDefault = 2; public const int EnzygoticTwinsChanceAdjustDefault = 2;
public const int MaxEnzygoticTwinsDefault = 9; public const int MaxEnzygoticTwinsDefault = 9;
@ -46,9 +41,6 @@ namespace RJW_Menstruation
public static float CumFertilityDecayRatio = CumFertilityDecayRatioDefault; public static float CumFertilityDecayRatio = CumFertilityDecayRatioDefault;
public static int CumFertilityDecayRatioAdjust = CumFertilityDecayRatioAdjustDefault; public static int CumFertilityDecayRatioAdjust = CumFertilityDecayRatioAdjustDefault;
public static int CycleAcceleration = CycleAccelerationDefault; public static int CycleAcceleration = CycleAccelerationDefault;
public static int ColonistTickInterval = ColonistTickIntervalDefault;
public static int NonColonistTickInterval = NonColonistTickIntervalDefault;
public static int AnimalTickInterval = AnimalTickIntervalDefault;
public static bool EnableWombIcon = true; public static bool EnableWombIcon = true;
public static bool EnableDraftedIcon = true; public static bool EnableDraftedIcon = true;
public static bool EnableAnimalCycle = false; public static bool EnableAnimalCycle = false;
@ -93,9 +85,6 @@ namespace RJW_Menstruation
EnableGatherCumGizmo = true; EnableGatherCumGizmo = true;
EnableAnimalCycle = false; EnableAnimalCycle = false;
CycleAcceleration = CycleAccelerationDefault; CycleAcceleration = CycleAccelerationDefault;
ColonistTickInterval = ColonistTickIntervalDefault;
NonColonistTickInterval = NonColonistTickIntervalDefault;
AnimalTickInterval = AnimalTickIntervalDefault;
EstrusOverridesHookupSettings = false; EstrusOverridesHookupSettings = false;
EstrusFuckabilityToHookup = RJWHookupSettings.MinimumFuckabilityToHookup; EstrusFuckabilityToHookup = RJWHookupSettings.MinimumFuckabilityToHookup;
EstrusAttractivenessToHookup = RJWHookupSettings.MinimumAttractivenessToHookup; EstrusAttractivenessToHookup = RJWHookupSettings.MinimumAttractivenessToHookup;
@ -190,51 +179,48 @@ namespace RJW_Menstruation
public override void ExposeData() public override void ExposeData()
{ {
Scribe_Values.Look(ref ImplantationChanceAdjust, "ImplantationChanceAdjust", ImplantationChanceAdjustDefault); Scribe_Values.Look(ref ImplantationChanceAdjust, "ImplantationChanceAdjust", ImplantationChanceAdjust, true);
Scribe_Values.Look(ref ImplantationChance, "ImplantationChance", ImplantationChanceDefault); Scribe_Values.Look(ref ImplantationChance, "ImplantationChance", ImplantationChance, true);
Scribe_Values.Look(ref FertilizeChanceAdjust, "FertilizeChanceAdjust", FertilizeChanceAdjustDefault); Scribe_Values.Look(ref FertilizeChanceAdjust, "FertilizeChanceAdjust", FertilizeChanceAdjust, true);
Scribe_Values.Look(ref FertilizeChance, "FertilizeChance", FertilizeChanceDefault); Scribe_Values.Look(ref FertilizeChance, "FertilizeChance", FertilizeChance, true);
Scribe_Values.Look(ref CumDecayRatioAdjust, "CumDecayRatioAdjust", CumDecayRatioAdjustDefault); Scribe_Values.Look(ref CumDecayRatioAdjust, "CumDecayRatioAdjust", CumDecayRatioAdjust, true);
Scribe_Values.Look(ref CumDecayRatio, "CumDecayRatio", CumDecayRatioDefault); Scribe_Values.Look(ref CumDecayRatio, "CumDecayRatio", CumDecayRatio, true);
Scribe_Values.Look(ref CumFertilityDecayRatioAdjust, "CumFertilityDecayRatioAdjust", CumFertilityDecayRatioAdjustDefault); Scribe_Values.Look(ref CumFertilityDecayRatioAdjust, "CumFertilityDecayRatioAdjust", CumFertilityDecayRatioAdjust, true);
Scribe_Values.Look(ref CumFertilityDecayRatio, "CumFertilityDecayRatio", CumFertilityDecayRatioDefault); Scribe_Values.Look(ref CumFertilityDecayRatio, "CumFertilityDecayRatio", CumFertilityDecayRatio, true);
Scribe_Values.Look(ref CycleAcceleration, "CycleAcceleration", CycleAccelerationDefault); Scribe_Values.Look(ref CycleAcceleration, "CycleAcceleration", CycleAcceleration, true);
Scribe_Values.Look(ref ColonistTickInterval, "ColonistTickInterval", ColonistTickIntervalDefault); Scribe_Values.Look(ref EnableWombIcon, "EnableWombIcon", EnableWombIcon, true);
Scribe_Values.Look(ref NonColonistTickInterval, "NonColonistTickInterval", NonColonistTickIntervalDefault); Scribe_Values.Look(ref EnableDraftedIcon, "EnableDraftedIcon", EnableDraftedIcon, true);
Scribe_Values.Look(ref AnimalTickInterval, "AnimalTickInterval", AnimalTickIntervalDefault); Scribe_Values.Look(ref EnableAnimalCycle, "EnableAnimalCycle", EnableAnimalCycle, true);
Scribe_Values.Look(ref EnableWombIcon, "EnableWombIcon", true); Scribe_Values.Look(ref DrawWombStatus, "DrawWombStatus", DrawWombStatus, true);
Scribe_Values.Look(ref EnableDraftedIcon, "EnableDraftedIcon", true); Scribe_Values.Look(ref DrawVaginaStatus, "DrawVaginaStatus", DrawVaginaStatus, true);
Scribe_Values.Look(ref EnableAnimalCycle, "EnableAnimalCycle", false); Scribe_Values.Look(ref DrawEggOverlay, "DrawEggOvray", DrawEggOverlay, true);
Scribe_Values.Look(ref DrawWombStatus, "DrawWombStatus", true); Scribe_Values.Look(ref Debug, "Debug", Debug, true);
Scribe_Values.Look(ref DrawVaginaStatus, "DrawVaginaStatus", true); Scribe_Values.Look(ref infoDetail, "InfoDetail", infoDetail, true);
Scribe_Values.Look(ref DrawEggOverlay, "DrawEggOvray", true); Scribe_Values.Look(ref EnableMenopause, "EnableMenopause", EnableMenopause, true);
Scribe_Values.Look(ref Debug, "Debug", false); Scribe_Values.Look(ref EstrusOverridesHookupSettings, "EstrusOverridesHookupSettings", EstrusOverridesHookupSettings, true);
Scribe_Values.Look(ref infoDetail, "InfoDetail", DetailLevel.All);
Scribe_Values.Look(ref EnableMenopause, "EnableMenopause", true);
Scribe_Values.Look(ref EstrusOverridesHookupSettings, "EstrusOverridesHookupSettings", false);
Scribe_Values.Look(ref EstrusFuckabilityToHookup, "EstrusFuckabilityToHookup", EstrusFuckabilityToHookup, true); Scribe_Values.Look(ref EstrusFuckabilityToHookup, "EstrusFuckabilityToHookup", EstrusFuckabilityToHookup, true);
Scribe_Values.Look(ref EstrusAttractivenessToHookup, "EstrusAttractivenessToHookup", EstrusAttractivenessToHookup, true); Scribe_Values.Look(ref EstrusAttractivenessToHookup, "EstrusAttractivenessToHookup", EstrusAttractivenessToHookup, true);
Scribe_Values.Look(ref EstrusRelationshipToHookup, "EstrusRelationshipToHookup", EstrusRelationshipToHookup, true); Scribe_Values.Look(ref EstrusRelationshipToHookup, "EstrusRelationshipToHookup", EstrusRelationshipToHookup, true);
Scribe_Values.Look(ref PregnancySource, "PregnancySource", PregnancyType.MultiplePregnancy); Scribe_Values.Look(ref PregnancySource, "PregnancySource", PregnancySource, true);
Scribe_Values.Look(ref EnableBiotechTwins, "EnableBiotechTwins", false); Scribe_Values.Look(ref EnableBiotechTwins, "EnableBiotechTwins", EnableBiotechTwins, true);
Scribe_Values.Look(ref EnableHeteroOvularTwins, "EnableHeteroOvularTwins", true); Scribe_Values.Look(ref EnableHeteroOvularTwins, "EnableHeteroOvularTwins", EnableHeteroOvularTwins, true);
Scribe_Values.Look(ref EnableEnzygoticTwins, "EnableEnzygoticTwins", true); Scribe_Values.Look(ref EnableEnzygoticTwins, "EnableEnzygoticTwins", EnableEnzygoticTwins, true);
Scribe_Values.Look(ref EnzygoticTwinsChance, "EnzygoticTwinsChance", EnzygoticTwinsChanceDefault); Scribe_Values.Look(ref EnzygoticTwinsChance, "EnzygoticTwinsChance", EnzygoticTwinsChance, true);
Scribe_Values.Look(ref EnzygoticTwinsChanceAdjust, "EnzygoticTwinsChanceAdjust", EnzygoticTwinsChanceAdjustDefault); Scribe_Values.Look(ref EnzygoticTwinsChanceAdjust, "EnzygoticTwinsChanceAdjust", EnzygoticTwinsChanceAdjust, true);
Scribe_Values.Look(ref MaxEnzygoticTwins, "MaxEnzygoticTwins", MaxEnzygoticTwinsDefault); Scribe_Values.Look(ref MaxEnzygoticTwins, "MaxEnzygoticTwins", MaxEnzygoticTwins, true);
Scribe_Values.Look(ref BleedingAmount, "BleedingAmount", BleedingAmountDefault); Scribe_Values.Look(ref BleedingAmount, "BleedingAmount", BleedingAmount, true);
Scribe_Values.Look(ref EnableButtonInHT, "EnableButtonInHT", false); Scribe_Values.Look(ref EnableButtonInHT, "EnableButtonInHT", EnableButtonInHT, true);
Scribe_Values.Look(ref EnableGatherCumGizmo, "EnableGatherCumGizmo", true); Scribe_Values.Look(ref EnableGatherCumGizmo, "EnableGatherCumGizmo", true, true);
Scribe_Values.Look(ref ShowFlag, "ShowFlag", PawnFlags.Colonist | PawnFlags.Prisoner); Scribe_Values.Look(ref ShowFlag, "ShowFlag", ShowFlag, true);
Scribe_Values.Look(ref UseHybridExtention, "UseHybridExtention", true); Scribe_Values.Look(ref UseHybridExtention, "UseHybridExtention", UseHybridExtention, true);
Scribe_Values.Look(ref MotherFirst, "MotherFirst", false); Scribe_Values.Look(ref MotherFirst, "MotherFirst", MotherFirst, true);
Scribe_Values.Look(ref MaxBreastIncrementFactor, "MaxBreastIncrementFactor", MaxBreastIncrementFactorDefault); Scribe_Values.Look(ref MaxBreastIncrementFactor, "MaxBreastIncrementFactor", MaxBreastIncrementFactor, true);
Scribe_Values.Look(ref MaxNippleIncrementFactor, "MaxNippleIncrementFactor", MaxNippleIncrementFactorDefault); Scribe_Values.Look(ref MaxNippleIncrementFactor, "MaxNippleIncrementFactor", MaxNippleIncrementFactor, true);
Scribe_Values.Look(ref PermanentNippleChange, "PermanentNippleChange", PermanentNippleChangeDefault); Scribe_Values.Look(ref PermanentNippleChange, "PermanentNippleChange", PermanentNippleChange, true);
Scribe_Values.Look(ref AllowShrinkIcon, "AllowShrinkIcon", false); Scribe_Values.Look(ref AllowShrinkIcon, "AllowShrinkIcon", AllowShrinkIcon, true);
Scribe_Values.Look(ref EggLifespanMultiplier, "EggLifespanMultiplier", EggLifespanMultiplierDefault); Scribe_Values.Look(ref EggLifespanMultiplier, "EggLifespanMultiplier", EggLifespanMultiplier, true);
Scribe_Values.Look(ref EnableBirthVaginaMorph, "EnableBirthVaginaMorph", false); Scribe_Values.Look(ref EnableBirthVaginaMorph, "EnableBirthVaginaMorph", EnableBirthVaginaMorph, true);
Scribe_Values.Look(ref VaginaMorphPower, "VaginaMorphPower", VaginaMorphPowerDefault); Scribe_Values.Look(ref VaginaMorphPower, "VaginaMorphPower", VaginaMorphPower, true);
Scribe_Collections.Look(ref HybridOverride, saveDestroyedThings: true, label: "HybridOverride", lookMode: LookMode.Deep, ctorArgs: new object[0]); Scribe_Collections.Look(ref HybridOverride, saveDestroyedThings: true, label: "HybridOverride", lookMode: LookMode.Deep, ctorArgs: new object[0]);
base.ExposeData(); base.ExposeData();
} }
@ -288,9 +274,8 @@ namespace RJW_Menstruation
public override void DoSettingsWindowContents(Rect inRect) public override void DoSettingsWindowContents(Rect inRect)
{ {
Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f); Rect outRect = new Rect(0f, 30f, inRect.width, inRect.height - 30f);
float mainRectHeight = 126f + float mainRectHeight = 30f +
(Configurations.EnableWombIcon || Configurations.EnableButtonInHT ? 400f : 0f) + (Configurations.EnableWombIcon || Configurations.EnableButtonInHT ? 400f : 0f) +
(Configurations.EnableAnimalCycle ? 48f : 0f) +
(Configurations.EstrusOverridesHookupSettings ? 144f : 0f) + (Configurations.EstrusOverridesHookupSettings ? 144f : 0f) +
(Configurations.PregnancySource == Configurations.PregnancyType.MultiplePregnancy ? (Configurations.EnableEnzygoticTwins ? 175f : 75f) : 0f) + (Configurations.PregnancySource == Configurations.PregnancyType.MultiplePregnancy ? (Configurations.EnableEnzygoticTwins ? 175f : 75f) : 0f) +
(Configurations.PregnancySource == Configurations.PregnancyType.Biotech ? 75f : 0f) + (Configurations.PregnancySource == Configurations.PregnancyType.Biotech ? 75f : 0f) +
@ -418,11 +403,11 @@ namespace RJW_Menstruation
string estimatedlifespan; string estimatedlifespan;
if (semenlifespan < 0) if (semenlifespan < 0)
{ {
estimatedlifespan = string.Format(": Infinite", semenlifespan); estimatedlifespan = String.Format(": Infinite", semenlifespan);
} }
else else
{ {
estimatedlifespan = string.Format(": {0:0}h", semenlifespan); estimatedlifespan = String.Format(": {0:0}h", semenlifespan);
} }
listmain.LabelDouble(Translations.Option6_Label + " " + Configurations.CumFertilityDecayRatio * 100 + "%", Translations.EstimatedCumLifespan + estimatedlifespan, Translations.Option6_Desc); listmain.LabelDouble(Translations.Option6_Label + " " + Configurations.CumFertilityDecayRatio * 100 + "%", Translations.EstimatedCumLifespan + estimatedlifespan, Translations.Option6_Desc);
Configurations.CumFertilityDecayRatioAdjust = (int)listmain.Slider(Configurations.CumFertilityDecayRatioAdjust, 0, 1000); Configurations.CumFertilityDecayRatioAdjust = (int)listmain.Slider(Configurations.CumFertilityDecayRatioAdjust, 0, 1000);
@ -431,17 +416,6 @@ namespace RJW_Menstruation
listmain.Label(Translations.Option7_Label + " x" + Configurations.CycleAcceleration, -1, Translations.Option7_Desc); listmain.Label(Translations.Option7_Label + " x" + Configurations.CycleAcceleration, -1, Translations.Option7_Desc);
Configurations.CycleAcceleration = (int)listmain.Slider(Configurations.CycleAcceleration, 1, 50); Configurations.CycleAcceleration = (int)listmain.Slider(Configurations.CycleAcceleration, 1, 50);
listmain.LabelDouble(Translations.Option_ColonistUpdateInterval_Label, GenDate.ToStringTicksToPeriod(Configurations.ColonistTickInterval), Translations.Option_ColonistUpdateInterval_Desc);
Configurations.ColonistTickInterval = (int)Mathf.Exp(listmain.Slider(Mathf.Log(Configurations.ColonistTickInterval), Mathf.Log(Configurations.TickIntervalMinimum), Mathf.Log(4 * GenDate.TicksPerHour)));
listmain.LabelDouble(Translations.Option_NonColonistUpdateInterval_Label, GenDate.ToStringTicksToPeriod(Configurations.NonColonistTickInterval), Translations.Option_NonColonistUpdateInterval_Desc);
Configurations.NonColonistTickInterval = (int)Mathf.Exp(listmain.Slider(Mathf.Log(Configurations.NonColonistTickInterval), Mathf.Log(Configurations.TickIntervalMinimum), Mathf.Log(4 * GenDate.TicksPerHour)));
if(Configurations.EnableAnimalCycle)
{
listmain.LabelDouble(Translations.Option_AnimalUpdateInterval_Label, GenDate.ToStringTicksToPeriod(Configurations.AnimalTickInterval), Translations.Option_AnimalUpdateInterval_Desc);
Configurations.AnimalTickInterval = (int)Mathf.Exp(listmain.Slider(Mathf.Log(Configurations.AnimalTickInterval), Mathf.Log(Configurations.TickIntervalMinimum), Mathf.Log(4 * GenDate.TicksPerHour)));
}
float var2 = EstimatedBleedingAmountPerHour; float var2 = EstimatedBleedingAmountPerHour;
float var1 = Math.Max(EstimatedBleedingAmount, var2); float var1 = Math.Max(EstimatedBleedingAmount, var2);

View file

@ -165,15 +165,16 @@ namespace RJW_Menstruation
Scribe_References.Look(ref pawn, "pawn", true); Scribe_References.Look(ref pawn, "pawn", true);
Scribe_Values.Look(ref volume, "volume", volume, true); Scribe_Values.Look(ref volume, "volume", volume, true);
Scribe_Values.Look(ref fertility, "fertility", fertility, true); Scribe_Values.Look(ref fertility, "fertility", fertility, true);
Scribe_Values.Look(ref notcumthickness, "notcumthickness", 0); Scribe_Values.Look(ref notcumthickness, "notcumthickness", notcumthickness, true);
Scribe_Values.Look(ref notcum, "notcum", false); Scribe_Values.Look(ref notcum, "notcum", notcum, true);
Scribe_Values.Look(ref notcumLabel, "notcumLabel", ""); Scribe_Values.Look(ref notcumLabel, "notcumLabel", notcumLabel, true);
Scribe_Values.Look(ref useCustomColor, "useCustomColor", false); Scribe_Values.Look(ref useCustomColor, "useCustomColor", useCustomColor, true);
Scribe_Values.Look(ref customColor, "customColor", default); Scribe_Values.Look(ref customColor, "customColor", customColor, true);
Scribe_Defs.Look(ref filthDef, "filthDef"); Scribe_Defs.Look(ref filthDef, "filthDef");
} }
public void MakeThinner(float speed) public void MakeThinner(int speed)
{ {
cumthickness = cumthickness.LerpMultiple(DecayResist, 0.3f, speed); cumthickness = cumthickness.LerpMultiple(DecayResist, 0.3f, speed);
} }
@ -204,11 +205,8 @@ namespace RJW_Menstruation
{ {
// comp is used for Hydrogen's RJW Muscle Injury // comp is used for Hydrogen's RJW Muscle Injury
float totalleak = volume; float totalleak = volume;
float decayPerInterval = 1 - Mathf.Pow(1 - Configurations.CumDecayRatio, comp.SimulationsPerHour); volume *= Math.Max(0, (1 - (Configurations.CumDecayRatio * (1 - DecayResist)) * leakfactor));
float fertilityDecayPerInterval = 1 - Mathf.Pow(1 - Configurations.CumFertilityDecayRatio, comp.SimulationsPerHour); fertility *= Math.Max(0, 1 - (Configurations.CumFertilityDecayRatio * (1 - DecayResist) + antisperm));
antisperm *= comp.SimulationsPerHour;
volume *= Math.Max(0, 1 - decayPerInterval * (1 - DecayResist) * leakfactor);
fertility *= Math.Max(0, 1 - (fertilityDecayPerInterval * (1 - DecayResist) + antisperm));
CutMinor(); CutMinor();
totalleak -= volume; totalleak -= volume;
return totalleak; return totalleak;

View file

@ -10,10 +10,7 @@ namespace RJW_Menstruation
private static void SetFollicular(Pawn p) private static void SetFollicular(Pawn p)
{ {
foreach (HediffComp_Menstruation comp in p.GetMenstruationComps()) foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
{
comp.GoNextStage(HediffComp_Menstruation.Stage.Follicular); comp.GoNextStage(HediffComp_Menstruation.Stage.Follicular);
comp.RemoveAllEggs();
}
Messages.Message($"{p} is now follicular", p, MessageTypeDefOf.NeutralEvent, false); Messages.Message($"{p} is now follicular", p, MessageTypeDefOf.NeutralEvent, false);
} }
@ -37,10 +34,7 @@ namespace RJW_Menstruation
private static void SetBleeding(Pawn p) private static void SetBleeding(Pawn p)
{ {
foreach (HediffComp_Menstruation comp in p.GetMenstruationComps()) foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
{
comp.GoNextStage(HediffComp_Menstruation.Stage.Bleeding); comp.GoNextStage(HediffComp_Menstruation.Stage.Bleeding);
comp.RemoveAllEggs();
}
Messages.Message($"{p} is now bleeding", p, MessageTypeDefOf.NeutralEvent, false); Messages.Message($"{p} is now bleeding", p, MessageTypeDefOf.NeutralEvent, false);
} }
/* /*
@ -63,13 +57,6 @@ namespace RJW_Menstruation
comp.RemoveAllCums(); comp.RemoveAllCums();
Messages.Message($"All cum removed from {p}'s womb", p, MessageTypeDefOf.NeutralEvent, false); Messages.Message($"All cum removed from {p}'s womb", p, MessageTypeDefOf.NeutralEvent, false);
} }
[DebugAction("RJW Menstruation", "Remove all eggs from pawn's womb", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void RemoveEggs(Pawn p)
{
foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
comp.RemoveAllEggs();
Messages.Message($"All eggs removed from {p}'s womb", p, MessageTypeDefOf.NeutralEvent, false);
}
[DebugAction("RJW Menstruation", "Add egg to pawn's next ovulation", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)] [DebugAction("RJW Menstruation", "Add egg to pawn's next ovulation", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void AddEgg(Pawn p) private static void AddEgg(Pawn p)
{ {

View file

@ -89,7 +89,7 @@ namespace RJW_Menstruation
else m.moodPowerFactor = 0.3f; else m.moodPowerFactor = 0.3f;
} }
if (pawn.IsProPregnancy()) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraceptivePill); if (pawn.HasQuirk(QuirkUtility.Quirks.Breeder)) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraceptivePill);
else pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.TookContraceptivePill); else pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.TookContraceptivePill);
} }
} }

View file

@ -69,12 +69,15 @@ namespace RJW_Menstruation
get get
{ {
if (babyHalfAge > 0f) return babyHalfAge; if (babyHalfAge > 0f) return babyHalfAge;
List<LifeStageAge> ages = Pawn.RaceProps.lifeStageAges; List<LifeStageAge> ages = Pawn.def.race.lifeStageAges;
if (ages?.Count > 1) if (ages?.Count > 1)
babyHalfAge = ages[1].minAge / 2; babyHalfAge = ages[1].minAge / 2;
if (babyHalfAge <= 0) babyHalfAge = 1.2f / 2; // Default to human if (babyHalfAge <= 0) babyHalfAge = 1.2f / 2; // Default to human
if (RJWPregnancySettings.phantasy_pregnancy)
babyHalfAge /= GenDate.DaysPerYear;
return babyHalfAge; return babyHalfAge;
} }
} }
@ -137,10 +140,10 @@ namespace RJW_Menstruation
{ {
base.CompExposeData(); base.CompExposeData();
Scribe_Values.Look(ref ageOfLastBirth, "ageOfLastBirth", -1); Scribe_Values.Look(ref ageOfLastBirth, "ageOfLastBirth", ageOfLastBirth, true);
Scribe_Values.Look(ref maxBreastIncrement, "maxBreastIncrement", maxBreastIncrement, true); Scribe_Values.Look(ref maxBreastIncrement, "maxBreastIncrement", maxBreastIncrement, true);
Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", 0.0f); Scribe_Values.Look(ref breastSizeIncreased, "breastSizeIncreased", breastSizeIncreased, true);
Scribe_Values.Look(ref nippleProgress, "nippleProgress", 0.0f); Scribe_Values.Look(ref nippleProgress, "nippleProgress", nippleProgress, true);
Scribe_Values.Look(ref baseAlpha, "baseAlpha", baseAlpha, true); Scribe_Values.Look(ref baseAlpha, "baseAlpha", baseAlpha, true);
Scribe_Values.Look(ref baseAreola, "baseAreola", baseAreola, true); Scribe_Values.Look(ref baseAreola, "baseAreola", baseAreola, true);
Scribe_Values.Look(ref baseNipple, "baseNipple", baseNipple, true); Scribe_Values.Look(ref baseNipple, "baseNipple", baseNipple, true);
@ -149,7 +152,7 @@ namespace RJW_Menstruation
public bool ShouldSimulate() public bool ShouldSimulate()
{ {
if (!Configurations.EnableAnimalCycle && Pawn.IsAnimal()) return false; if (!Configurations.EnableAnimalCycle && Pawn.IsAnimal()) return false;
if (Pawn.SpawnedOrAnyParentSpawned || Pawn.IsCaravanMember() || PawnUtility.IsTravelingInTransportPodWorldObject(Pawn)) return true; if (Pawn.Spawned || Pawn.IsCaravanMember() || PawnUtility.IsTravelingInTransportPodWorldObject(Pawn)) return true;
return false; return false;
} }
@ -196,19 +199,19 @@ namespace RJW_Menstruation
protected long CalculateLastBirth() protected long CalculateLastBirth()
{ {
long youngestAge = -1; long youngestAge = (long)(BabyHalfAge * GenDate.TicksPerYear) * -2; // So a newborn isn't considered a new mother, either
if ((Pawn.relations == null)) return youngestAge; if ((Pawn.relations == null)) return youngestAge;
List<Hediff_BasePregnancy> rjwPregnancies = new List<Hediff_BasePregnancy>(); List<Hediff_BasePregnancy> pregnancies = new List<Hediff_BasePregnancy>();
Pawn.health.hediffSet.GetHediffs(ref rjwPregnancies); Pawn.health.hediffSet.GetHediffs(ref pregnancies);
bool hasChild = Pawn.relations.Children. bool hasChild = Pawn.relations.Children.
Where(child => !rjwPregnancies.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 Where(child => child.GetMother() == Pawn). // not Dad
TryMinBy(child => child.ageTracker.AgeBiologicalTicks, out Pawn youngest); TryMinBy(child => child.ageTracker.AgeBiologicalTicks, out Pawn youngest);
if (hasChild) youngestAge = Math.Max(Pawn.ageTracker.AgeBiologicalTicks - youngest.ageTracker.AgeBiologicalTicks, -1); if (hasChild) youngestAge = Pawn.ageTracker.AgeBiologicalTicks - youngest.ageTracker.AgeBiologicalTicks;
return youngestAge; return youngestAge;
} }
@ -221,7 +224,7 @@ namespace RJW_Menstruation
{ {
maxBreastIncrement = Utility.RandGaussianLike(0.088f, 0.202f); maxBreastIncrement = Utility.RandGaussianLike(0.088f, 0.202f);
} }
if (ageOfLastBirth == 0 || ageOfLastBirth < -1) if (ageOfLastBirth == 0)
{ {
ageOfLastBirth = CalculateLastBirth(); ageOfLastBirth = CalculateLastBirth();
} }
@ -250,7 +253,7 @@ namespace RJW_Menstruation
debugGrowthStatus = "Base size (ageless)"; debugGrowthStatus = "Base size (ageless)";
} }
// The youngest child is less than halfway into babyhood: Full size // The youngest child is less than halfway into babyhood: Full size
else if (ageOfLastBirth > 0 && ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks) else if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks)
{ {
debugGrowthStatus = "Full size due to young child"; debugGrowthStatus = "Full size due to young child";
if (breastSizeIncreased < MaxBreastIncrement) if (breastSizeIncreased < MaxBreastIncrement)
@ -296,7 +299,7 @@ namespace RJW_Menstruation
float newNippleProgress; float newNippleProgress;
if (Pawn.ageTracker.BiologicalTicksPerTick <= 0f) if (Pawn.ageTracker.BiologicalTicksPerTick <= 0f)
newNippleProgress = 0f; newNippleProgress = 0f;
else if (ageOfLastBirth > 0 && ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks) else if (ageOfLastBirth + BabyHalfAge * GenDate.TicksPerYear > Pawn.ageTracker.AgeBiologicalTicks)
newNippleProgress = 1f; newNippleProgress = 1f;
else if (Pawn.IsRJWPregnant() || Pawn.IsBiotechPregnant()) else if (Pawn.IsRJWPregnant() || Pawn.IsBiotechPregnant())
newNippleProgress = nippleTransitions.Evaluate(Pawn.GetFarthestPregnancyProgress()); newNippleProgress = nippleTransitions.Evaluate(Pawn.GetFarthestPregnancyProgress());

View file

@ -15,14 +15,6 @@ namespace RJW_Menstruation
public class HediffComp_InducedOvulator : HediffComp_Menstruation public class HediffComp_InducedOvulator : HediffComp_Menstruation
{ {
protected bool hadOvulatoryStage = false; // Regardless of whether an egg was actually produced
protected override void InitializeExtraValues()
{
base.InitializeExtraValues();
hadOvulatoryStage |= IsEggExist;
}
public override string GetCurStageDesc public override string GetCurStageDesc
{ {
get get
@ -43,7 +35,7 @@ namespace RJW_Menstruation
protected override float RaceCyclesPerYear() protected override float RaceCyclesPerYear()
{ {
// Don't bother with breeding season, since so much time is planned to be spent pregnant. // Don't bother with breeding season, since so much time is planned to be spent pregnant.
float pregnanciesPerYear = GenDate.DaysPerYear / Mathf.Max(1, Pawn.RaceProps.gestationPeriodDays); float pregnanciesPerYear = GenDate.DaysPerYear / Mathf.Max(1, Pawn.def.race.gestationPeriodDays);
return 2 * pregnanciesPerYear / Configurations.ImplantationChanceDefault; return 2 * pregnanciesPerYear / Configurations.ImplantationChanceDefault;
} }
@ -54,35 +46,21 @@ namespace RJW_Menstruation
return Mathf.CeilToInt((Pawn.relations?.ChildrenCount ?? 0) / Configurations.ImplantationChanceDefault); return Mathf.CeilToInt((Pawn.relations?.ChildrenCount ?? 0) / Configurations.ImplantationChanceDefault);
} }
public override void CompExposeData()
{
base.CompExposeData();
Scribe_Values.Look(ref hadOvulatoryStage, "hadOvulatoryStage", false);
}
protected override void GoOvulatoryStage() protected override void GoOvulatoryStage()
{ {
estrusflag = false; estrusflag = false;
hadOvulatoryStage = false;
GoNextStage(Stage.Luteal); GoNextStage(Stage.Luteal);
} }
protected override void OvulatoryAction()
{
base.OvulatoryAction();
hadOvulatoryStage = true;
}
protected override void LutealAction()
{
base.LutealAction();
if (curStage != Stage.Luteal) hadOvulatoryStage = false;
}
protected override void AfterCumIn(Pawn cummer) protected override void AfterCumIn(Pawn cummer)
{ {
base.AfterCumIn(cummer); base.AfterCumIn(cummer);
if (curStage == Stage.Follicular) GoNextStage(Stage.Ovulatory); switch (curStage)
{
case Stage.Follicular:
GoNextStage(Stage.Ovulatory);
break;
}
} }
public override bool IsDangerDay public override bool IsDangerDay
@ -97,7 +75,7 @@ namespace RJW_Menstruation
case Stage.Ovulatory: case Stage.Ovulatory:
return true; return true;
case Stage.Luteal: case Stage.Luteal:
return hadOvulatoryStage && curStageTicks < EggLifespanTicks; return IsEggExist && curStageHrs < EggLifespanHours;
default: default:
return false; return false;
} }
@ -111,11 +89,11 @@ namespace RJW_Menstruation
switch (curStage) switch (curStage)
{ {
case Stage.Follicular: case Stage.Follicular:
return curStageTicks > currentIntervalTicks - Props.estrusDaysBeforeOvulation * GenDate.TicksPerDay; return curStageHrs > currentIntervalHours - Props.estrusDaysBeforeOvulation * 24;
case Stage.Ovulatory: case Stage.Ovulatory:
return true; return true;
case Stage.Luteal: case Stage.Luteal:
return hadOvulatoryStage && curStageTicks < EggLifespanTicks; return IsEggExist && curStageHrs < EggLifespanHours;
default: default:
return false; return false;
} }

View file

@ -16,28 +16,23 @@ namespace RJW_Menstruation
public class HediffComp_PeriodicOvulator : HediffComp_Menstruation public class HediffComp_PeriodicOvulator : HediffComp_Menstruation
{ {
public int ticksToNextCycle = -100000; public int hoursToNextCycle = -100000;
public int averageCycleIntervalTicks = -1; public int averageCycleIntervalHours = -1;
public new CompProperties_PeriodicOvulator Props; public new CompProperties_PeriodicOvulator Props;
protected override void PreInitialize()
{
base.PreInitialize();
Props = (CompProperties_PeriodicOvulator)props;
}
protected override void InitializeExtraValues() protected override void InitializeExtraValues()
{ {
base.InitializeExtraValues(); base.InitializeExtraValues();
if (averageCycleIntervalTicks < 0) Props = (CompProperties_PeriodicOvulator)props;
if (averageCycleIntervalHours < 0)
{ {
averageCycleIntervalTicks = (int)(Props.cycleIntervalDays.RandomInRange * GenDate.TicksPerDay / cycleSpeed); averageCycleIntervalHours = (int)(24f * Props.cycleIntervalDays.RandomInRange / cycleSpeed);
if (ticksToNextCycle < -50000) if (hoursToNextCycle < -50000)
ticksToNextCycle = Rand.Range(0, averageCycleIntervalTicks); hoursToNextCycle = Rand.Range(0, averageCycleIntervalHours);
// Make the cutoff halfway into cycle, just to be sure there isn't a double-cycle the first time // 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.Luteal || curStage == Stage.Bleeding) if ((curStage == Stage.Follicular || curStage == Stage.Luteal || curStage == Stage.Bleeding)
&& (averageCycleIntervalTicks - ticksToNextCycle) / 2 >= GenDate.TicksPerDay * (Props.follicularIntervalDays + Props.lutealIntervalDays) / cycleSpeed) && (averageCycleIntervalHours - hoursToNextCycle) / 2 >= 24 * (Props.follicularIntervalDays + Props.lutealIntervalDays) / cycleSpeed)
GoNextStage(Stage.Anestrus); GoNextStage(Stage.Anestrus);
} }
} }
@ -45,46 +40,40 @@ namespace RJW_Menstruation
protected override float RaceCyclesPerYear() protected override float RaceCyclesPerYear()
{ {
// Don't bother trying to work seasonal breeding into the math // Don't bother trying to work seasonal breeding into the math
// Base it off of the shortest cycle interval of the vagina // Due to the enormous variation in possible cycle gaps, cheat and base it off the individual
return GenDate.DaysPerYear / (Props.cycleIntervalDays.TrueMin / Configurations.CycleAccelerationDefault); return averageCycleIntervalHours * cycleSpeed / (24 * 360); // cancel out their cycleSpeed from initialization to get their "normal" speed
} }
protected override void BeforeSimulator() protected override void BeforeSimulator()
{ {
base.BeforeSimulator(); base.BeforeSimulator();
if (ticksToNextCycle > 0) ticksToNextCycle -= TickInterval * Configurations.CycleAcceleration; if (hoursToNextCycle > 0) hoursToNextCycle -= Configurations.CycleAcceleration;
} }
public override void CompExposeData() public override void CompExposeData()
{ {
base.CompExposeData(); base.CompExposeData();
if (Scribe.mode == LoadSaveMode.LoadingVars) Scribe_Values.Look(ref hoursToNextCycle, "hoursToNextCycle", hoursToNextCycle, true);
{ Scribe_Values.Look(ref averageCycleIntervalHours, "averageCycleIntervalHours", averageCycleIntervalHours, true);
int hoursToNextCycle = -1;
int averageCycleIntervalHours = -1;
Scribe_Values.Look(ref hoursToNextCycle, "hoursToNextCycle", hoursToNextCycle, true);
Scribe_Values.Look(ref averageCycleIntervalHours, "averageCycleIntervalHours", averageCycleIntervalHours, true);
if (hoursToNextCycle >= 0) ticksToNextCycle = hoursToNextCycle * GenDate.TicksPerHour;
if (averageCycleIntervalHours >= 0) averageCycleIntervalTicks = averageCycleIntervalHours * GenDate.TicksPerHour;
}
Scribe_Values.Look(ref ticksToNextCycle, "ticksToNextCycle", ticksToNextCycle, true);
Scribe_Values.Look(ref averageCycleIntervalTicks, "averageCycleIntervalTicks", averageCycleIntervalTicks, true);
} }
protected override int TicksToNextStage() protected override int HoursToNextStage()
{ {
if (curStage == Stage.Anestrus && ticksToNextCycle > 0) return ticksToNextCycle / Configurations.CycleAcceleration; if (curStage == Stage.Anestrus && hoursToNextCycle > 0) return hoursToNextCycle / Configurations.CycleAcceleration;
else return base.TicksToNextStage(); else return base.HoursToNextStage();
} }
protected override void BleedingAction() protected override void BleedingAction()
{ {
base.BleedingAction(); if (curStageHrs >= currentIntervalHours)
if (curStage != Stage.Bleeding)
{ {
Hediff hediff = Pawn.health.hediffSet.GetFirstHediffOfDef(VariousDefOf.Hediff_MenstrualCramp);
if (hediff != null && !Pawn.GetMenstruationComps().Any(comp => comp != this && comp.curStage == Stage.Bleeding)) Pawn.health.RemoveHediff(hediff);
estrusflag = false; estrusflag = false;
GoNextStage(Stage.Anestrus); GoNextStage(Stage.Anestrus);
return;
} }
else base.BleedingAction();
} }
protected override void PregnantAction() protected override void PregnantAction()
@ -92,14 +81,14 @@ namespace RJW_Menstruation
base.PregnantAction(); base.PregnantAction();
if (curStage != Stage.Pregnant) if (curStage != Stage.Pregnant)
// Go halfway into the cycle // Go halfway into the cycle
ticksToNextCycle = (int)(averageCycleIntervalTicks * (1 + Rand.Range(-cycleVariability, cycleVariability))) / 2; hoursToNextCycle = (int)(averageCycleIntervalHours * (1 + Rand.Range(-cycleVariability, cycleVariability))) / 2;
} }
protected override void AnestrusAction() protected override void AnestrusAction()
{ {
if (ticksToNextCycle <= 0) if (hoursToNextCycle <= 0)
{ {
ticksToNextCycle = (int)(averageCycleIntervalTicks * (1 + Rand.Range(-cycleVariability, cycleVariability))); hoursToNextCycle = (int)(averageCycleIntervalHours * (1 + Rand.Range(-cycleVariability, cycleVariability)));
if (IsBreedingSeason()) GoNextStage(Stage.Follicular); if (IsBreedingSeason()) GoNextStage(Stage.Follicular);
return; return;
} }
@ -110,7 +99,7 @@ namespace RJW_Menstruation
{ {
base.CopyCycleProperties(original); base.CopyCycleProperties(original);
if (original is HediffComp_PeriodicOvulator comp) if (original is HediffComp_PeriodicOvulator comp)
averageCycleIntervalTicks = comp.averageCycleIntervalTicks; averageCycleIntervalHours = comp.averageCycleIntervalHours;
} }
} }
} }

View file

@ -213,7 +213,7 @@ namespace RJW_Menstruation
PregnancyUtility.ApplyBirthOutcome(thisOutcome, quality, ritual, genes, geneticMother, birtherThing, thisFather, doctor, lordJobRitual, assignments); PregnancyUtility.ApplyBirthOutcome(thisOutcome, quality, ritual, genes, geneticMother, birtherThing, thisFather, doctor, lordJobRitual, assignments);
// No more babies if mom dies halfway through. Unrealistic maybe, but saves a lot of headache in ApplyBirthOutcome // No more babies if mom dies halfway through. Unrealistic maybe, but saves a lot of headache in ApplyBirthOutcome
if (mother.Dead) break; if (mother.health.Dead) break;
if (xxx.is_human(baby)) if (xxx.is_human(baby))
mother.records.Increment(xxx.CountOfBirthHuman); mother.records.Increment(xxx.CountOfBirthHuman);
else if (xxx.is_animal(baby)) else if (xxx.is_animal(baby))
@ -266,7 +266,7 @@ namespace RJW_Menstruation
baby.relations.ClearAllRelations(); baby.relations.ClearAllRelations();
PregnancyUtility.ApplyBirthOutcome(outcome, quality, ritual, genes, geneticMother, birtherThing, thisFather, doctor, lordJobRitual, assignments); PregnancyUtility.ApplyBirthOutcome(outcome, quality, ritual, genes, geneticMother, birtherThing, thisFather, doctor, lordJobRitual, assignments);
if (mother.Dead) break; if (mother.health.Dead) break;
if (xxx.is_human(baby)) if (xxx.is_human(baby))
mother.records.Increment(xxx.CountOfBirthHuman); mother.records.Increment(xxx.CountOfBirthHuman);
else if (xxx.is_animal(baby)) else if (xxx.is_animal(baby))

View file

@ -3,7 +3,6 @@ using RimWorld.Planet;
using rjw; using rjw;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics.Eventing.Reader;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using Verse; using Verse;
@ -218,50 +217,44 @@ namespace RJW_Menstruation
return wombtex; return wombtex;
} }
public static Texture2D GetOvaryIcon(this HediffComp_Menstruation comp)
{
const float ovaryChanceToShow_01 = 0.2f;
const float ovaryChanceToShow_02 = 0.8f;
float ovulatoryProgress;
bool isInduced = comp is HediffComp_InducedOvulator;
if (comp.curStage == HediffComp_Menstruation.Stage.Follicular &&
isInduced &&
comp.Pawn.jobs.curDriver is JobDriver_Sex job &&
job.Sexprops != null &&
!job.Sexprops.usedCondom &&
(job.Sexprops.sexType == xxx.rjwSextype.Vaginal || job.Sexprops.sexType == xxx.rjwSextype.DoublePenetration))
ovulatoryProgress = 0.0f;
else if (comp.curStage == HediffComp_Menstruation.Stage.Ovulatory) ovulatoryProgress = isInduced ? Mathf.Max(ovaryChanceToShow_01, comp.StageProgessNextUpdate) : comp.StageProgessNextUpdate;
// else if (comp.curStage == HediffComp_Menstruation.Stage.Luteal && comp.IsEggExist) return ContentFinder<Texture2D>.Get("Ovaries/Ovary_02", true);
else return ContentFinder<Texture2D>.Get("Womb/Empty", true);
float combinedAppearance = ovulatoryProgress * comp.OvulationChance;
if (combinedAppearance >= ovaryChanceToShow_02 && comp.OvulationChance >= 1.0f) return ContentFinder<Texture2D>.Get("Ovaries/Ovary_02", true);
else if (combinedAppearance >= ovaryChanceToShow_01) return ContentFinder<Texture2D>.Get("Ovaries/Ovary_01", true);
else return ContentFinder<Texture2D>.Get("Ovaries/Ovary_00", true);
}
public static Texture2D GetEggIcon(this HediffComp_Menstruation comp, bool includeOvary) public static Texture2D GetEggIcon(this HediffComp_Menstruation comp, bool includeOvary)
{ {
const float ovaryChanceToShow_01 = 0.4f;
const float ovaryChanceToShow_02 = 1.0f;
switch (comp.CurrentVisibleStage) switch (comp.CurrentVisibleStage)
{ {
case HediffComp_Menstruation.Stage.Follicular: case HediffComp_Menstruation.Stage.Follicular:
if (!includeOvary) break;
if (comp is HediffComp_InducedOvulator)
{
if (comp.Pawn.jobs.curDriver is JobDriver_Sex job &&
job.Sexprops != null &&
!job.Sexprops.usedCondom &&
(job.Sexprops.sexType == xxx.rjwSextype.Vaginal || job.Sexprops.sexType == xxx.rjwSextype.DoublePenetration))
return ContentFinder<Texture2D>.Get((comp.OvulationChance >= ovaryChanceToShow_01) ? "Ovaries/Ovary_01" : "Ovaries_Ovary_00", true);
else break;
}
if (comp.curStageHrs > comp.CurStageIntervalHours - 30) // Approximate time for ovulation to occur
return ContentFinder<Texture2D>.Get((comp.OvulationChance >= ovaryChanceToShow_01) ? "Ovaries/Ovary_01" : "Ovaries_Ovary_00", true);
else break;
case HediffComp_Menstruation.Stage.Ovulatory: case HediffComp_Menstruation.Stage.Ovulatory:
if (!includeOvary) break; if (!includeOvary) break;
else return GetOvaryIcon(comp); if (comp.OvulationChance >= ovaryChanceToShow_02)
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_02", true);
else if (comp.OvulationChance >= ovaryChanceToShow_01)
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_01", true);
else
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_00", true);
case HediffComp_Menstruation.Stage.Luteal: case HediffComp_Menstruation.Stage.Luteal:
if (!comp.IsEggExist) break; if (!comp.IsEggExist) break;
int fertTime = comp.EggFertilizedTime; int fertstage = comp.IsFertilized;
if (fertTime >= 0) if (fertstage >= 0)
{ {
if (fertTime <= GenDate.TicksPerHour * Configurations.CycleAcceleration) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilizing02", true); if (fertstage <= Configurations.CycleAcceleration) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilizing02", true);
else if (fertTime <= 18 * GenDate.TicksPerHour) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized00", true); else if (fertstage <= 18) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized00", true);
else if (fertTime <= 54 * GenDate.TicksPerHour) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized01", true); else if (fertstage <= 54) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized01", true);
else return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized02", true); else return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized02", true);
} }
else if (includeOvary && comp.curStageTicks <= comp.Props.ovulationIntervalHours * 0.4f * GenDate.TicksPerHour) // Total about as long as it spent in Ovary_01
{
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_02", true);
}
else if (comp.IsEggFertilizing) else if (comp.IsEggFertilizing)
{ {
if (comp.GetFertilityChance() < 0.5f) if (comp.GetFertilityChance() < 0.5f)
@ -355,7 +348,7 @@ namespace RJW_Menstruation
else if (hediff is Hediff_BasePregnancy rjw_preg) else if (hediff is Hediff_BasePregnancy rjw_preg)
return (rjw_preg.p_end_tick - rjw_preg.p_start_tick) / GenDate.TicksPerHour; return (rjw_preg.p_end_tick - rjw_preg.p_start_tick) / GenDate.TicksPerHour;
// TODO: Biotech pregnancy // TODO: Biotech pregnancy
else return hediff.pawn.RaceProps.gestationPeriodDays * GenDate.HoursPerDay; else return hediff.pawn.def.race.gestationPeriodDays * GenDate.HoursPerDay;
} }
public static float RandomVariabilityPercent(int recursion = 0) public static float RandomVariabilityPercent(int recursion = 0)
@ -407,22 +400,6 @@ namespace RJW_Menstruation
return false; return false;
} }
public static bool IsProPregnancy(this Pawn pawn)
{
if (pawn.HasQuirk(QuirkUtility.Quirks.Breeder) ||
pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish))
return true;
Ideo ideo = pawn.Ideo;
if (ideo == null || VariousDefOf.Pregnancy_Elevated == null) return false;
if (ideo.HasPrecept(VariousDefOf.Pregnancy_Elevated) ||
ideo.HasPrecept(VariousDefOf.Pregnancy_Holy) ||
ideo.HasPrecept(VariousDefOf.Pregnancy_Required))
return true;
return false;
}
public static float DamagePants(this Pawn pawn, float fluidAmount) public static float DamagePants(this Pawn pawn, float fluidAmount)
{ {
if (pawn.apparel == null) return 0; if (pawn.apparel == null) return 0;

View file

@ -23,11 +23,11 @@ namespace RJW_Menstruation
{ {
if (is_discovered || if (is_discovered ||
!xxx.is_human(pawn) || !xxx.is_human(pawn) ||
pawn.HasQuirk(QuirkUtility.Quirks.Breeder) || (pawn.Ideo?.HasPrecept(VariousDefOf.Pregnancy_Required) ?? false) || pawn.HasQuirk(QuirkUtility.Quirks.Breeder) ||
(pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Spouse) || (pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Spouse) ||
x.def.Equals(PawnRelationDefOf.Fiance))) != null) x.def.Equals(PawnRelationDefOf.Fiance))) != null)
return; return;
if (pawn.IsProPregnancy() || pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Lover)) != null) if (pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Lover)) != null)
{ {
pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancyMild); pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancyMild);
} }

View file

@ -117,7 +117,7 @@ namespace RJW_Menstruation
{ {
public static void Postfix(Thing birtherThing) public static void Postfix(Thing birtherThing)
{ {
if (birtherThing is Pawn pawn && !pawn.Dead) if (birtherThing is Pawn pawn && !pawn.health.Dead)
pawn.GetBreastComp()?.GaveBirth(); pawn.GetBreastComp()?.GaveBirth();
} }
} }
@ -192,20 +192,17 @@ namespace RJW_Menstruation
} }
} }
[HarmonyPatch(typeof(Pawn_GeneTracker), "AddGene", new Type[] { typeof(Gene), typeof(bool) })] [HarmonyPatch(typeof(Pawn_GeneTracker), "AddGene", new Type[] {typeof(Gene), typeof(bool)})]
public class AddGene_Patch public class AddGene_Patch
{ {
public static bool Prefix(ref Gene __result, Gene gene, Pawn ___pawn) public static bool Prefix(ref Gene __result, Gene gene, Pawn ___pawn)
{ {
if (!VariousDefOf.WombGenes.Contains(gene.def)) return true; if(VariousDefOf.WombGenes.Contains(gene.def) && !___pawn.GetMenstruationComps().Any())
bool keepGene; {
if (PawnGenerator.IsBeingGenerated(___pawn)) __result = null;
// During pawn generation, the vagina hediff doesn't exist yet, so use gender to decide instead return false;
// Not the most accurate, but close enough }
keepGene = ___pawn.gender == Gender.Female; else return true;
else keepGene = ___pawn.GetMenstruationComps().Any();
if (!keepGene) __result = null;
return keepGene;
} }
} }

View file

@ -16,7 +16,7 @@ namespace RJW_Menstruation.Patch
{ {
if (!__result.NullOrEmpty()) return; if (!__result.NullOrEmpty()) return;
if (cummedPawns.Contains(pawn)) if (cummedPawns.Contains(pawn))
__result = "EggFertOrCumInWomb"; __result = "Has cum or fertilized egg in a womb";
} }
} }

View file

@ -1,5 +1,4 @@
using HarmonyLib; using HarmonyLib;
using RimWorld;
using rjw; using rjw;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -43,12 +42,12 @@ namespace RJW_Menstruation
private static Gizmo CreateGizmo_WombStatus(Pawn pawn, HediffComp_Menstruation comp) private static Gizmo CreateGizmo_WombStatus(Pawn pawn, HediffComp_Menstruation comp)
{ {
Texture2D icon, icon_overlay; Texture2D icon, icon_overay;
StringBuilder description = new StringBuilder(); StringBuilder description = new StringBuilder();
if (Configurations.Debug) if (Configurations.Debug)
{ {
description description
.AppendFormat("{0}: {1}\n", comp.curStage, comp.curStageTicks / GenDate.TicksPerHour); .AppendFormat("{0}: {1}\n", comp.curStage, comp.curStageHrs);
if (comp.Pregnancy is Hediff_BasePregnancy rjwpreg) description if (comp.Pregnancy is Hediff_BasePregnancy rjwpreg) description
.AppendFormat("due: {0}\n", rjwpreg.DueDate()); .AppendFormat("due: {0}\n", rjwpreg.DueDate());
else if (comp.Pregnancy is Hediff_Pregnant biopreg) description else if (comp.Pregnancy is Hediff_Pregnant biopreg) description
@ -69,15 +68,15 @@ namespace RJW_Menstruation
float gestationProgress = comp.StageProgress; float gestationProgress = comp.StageProgress;
if (hediff is Hediff_BasePregnancy || hediff is HediffWithParents) if (hediff is Hediff_BasePregnancy || hediff is HediffWithParents)
{ {
if (gestationProgress < 0.2f) icon_overlay = comp.GetCumIcon(); if (gestationProgress < 0.2f) icon_overay = comp.GetCumIcon();
else icon_overlay = ContentFinder<Texture2D>.Get(("Womb/Empty"), true); else icon_overay = ContentFinder<Texture2D>.Get(("Womb/Empty"), true);
} }
else icon_overlay = ContentFinder<Texture2D>.Get(("Womb/Empty"), true); else icon_overay = ContentFinder<Texture2D>.Get(("Womb/Empty"), true);
} }
else else
{ {
icon = comp.GetWombIcon(); icon = comp.GetWombIcon();
icon_overlay = comp.GetCumIcon(); icon_overay = comp.GetCumIcon();
} }
} }
else else
@ -91,7 +90,7 @@ namespace RJW_Menstruation
{ {
icon = comp.GetWombIcon(); icon = comp.GetWombIcon();
} }
icon_overlay = comp.GetCumIcon(); icon_overay = comp.GetCumIcon();
} }
foreach (string s in comp.GetCumsInfo) description.AppendFormat("{0}\n", s); foreach (string s in comp.GetCumsInfo) description.AppendFormat("{0}\n", s);
@ -103,7 +102,7 @@ namespace RJW_Menstruation
defaultLabel = pawn.LabelShort, defaultLabel = pawn.LabelShort,
defaultDesc = description.ToString(), defaultDesc = description.ToString(),
icon = icon, icon = icon,
icon_overlay = icon_overlay, icon_overay = icon_overay,
shrinkable = Configurations.AllowShrinkIcon, shrinkable = Configurations.AllowShrinkIcon,
cumcolor = c, cumcolor = c,
comp = comp, comp = comp,

View file

@ -15,13 +15,13 @@ namespace RJW_Menstruation
return milktexturecache; return milktexturecache;
} }
} }
// Ovulation, sex drive // Sex drive
public static Texture2D OvulatoryTexture public static Texture2D SexDriveTexture
{ {
get get
{ {
if (ovulatorytexturecache == null) ovulatorytexturecache = SolidColorMaterials.NewSolidColorTexture(0.686f, 0.062f, 0.698f, 1.0f); if (sexdrivetexturecache == null) sexdrivetexturecache = SolidColorMaterials.NewSolidColorTexture(0.686f, 0.062f, 0.698f, 1.0f);
return ovulatorytexturecache; return sexdrivetexturecache;
} }
} }
// Bleeding, vulnerability // Bleeding, vulnerability
@ -93,7 +93,7 @@ namespace RJW_Menstruation
public static readonly Texture2D GatherCum_Pussy = ContentFinder<Texture2D>.Get("UI/Icon/ToPussy"); public static readonly Texture2D GatherCum_Pussy = ContentFinder<Texture2D>.Get("UI/Icon/ToPussy");
private static Texture2D milktexturecache = SolidColorMaterials.NewSolidColorTexture(0.992f, 1.0f, 0.960f, 1.0f); private static Texture2D milktexturecache = SolidColorMaterials.NewSolidColorTexture(0.992f, 1.0f, 0.960f, 1.0f);
private static Texture2D ovulatorytexturecache = SolidColorMaterials.NewSolidColorTexture(0.686f, 0.062f, 0.698f, 1.0f); private static Texture2D sexdrivetexturecache = SolidColorMaterials.NewSolidColorTexture(0.686f, 0.062f, 0.698f, 1.0f);
private static Texture2D bleedingtexturecache = SolidColorMaterials.NewSolidColorTexture(0.415f, 0.0f, 0.003f, 1.0f); private static Texture2D bleedingtexturecache = SolidColorMaterials.NewSolidColorTexture(0.415f, 0.0f, 0.003f, 1.0f);
private static Texture2D pregnanttexturecache = SolidColorMaterials.NewSolidColorTexture(0.082f, 0.453f, 0.6f, 1.0f); private static Texture2D pregnanttexturecache = SolidColorMaterials.NewSolidColorTexture(0.082f, 0.453f, 0.6f, 1.0f);
private static Texture2D recovertexturecache = SolidColorMaterials.NewSolidColorTexture(0.6f, 0.83f, 0.35f, 1.0f); private static Texture2D recovertexturecache = SolidColorMaterials.NewSolidColorTexture(0.6f, 0.83f, 0.35f, 1.0f);
@ -101,5 +101,10 @@ namespace RJW_Menstruation
private static Texture2D animaltexturecache = SolidColorMaterials.NewSolidColorTexture(0.411f, 0.521f, 0.878f, 1.0f); private static Texture2D animaltexturecache = SolidColorMaterials.NewSolidColorTexture(0.411f, 0.521f, 0.878f, 1.0f);
private static Texture2D lutealtexturecache = SolidColorMaterials.NewSolidColorTexture(0.843f, 0.474f, 0.6f, 1.0f); private static Texture2D lutealtexturecache = SolidColorMaterials.NewSolidColorTexture(0.843f, 0.474f, 0.6f, 1.0f);
private static Texture2D whoredtexturecache = SolidColorMaterials.NewSolidColorTexture(0.7f, 0.7f, 0.0f, 1.0f); private static Texture2D whoredtexturecache = SolidColorMaterials.NewSolidColorTexture(0.7f, 0.7f, 0.0f, 1.0f);
} }
} }

View file

@ -197,8 +197,7 @@ namespace RJW_Menstruation
public float absorbedfluids = 0; public float absorbedfluids = 0;
public bool dirty = false; public bool dirty = false;
public int wearTicks = 0; public int wearhours = 0;
protected virtual float PassiveAbsorptionPerHour => 0.1f;
public virtual bool LeakAfterDirty => def.GetModExtension<AbsorberModExtension>().leakAfterDirty; public virtual bool LeakAfterDirty => def.GetModExtension<AbsorberModExtension>().leakAfterDirty;
public virtual bool EffectAfterDirty => def.GetModExtension<AbsorberModExtension>().effectsAfterDirty; public virtual bool EffectAfterDirty => def.GetModExtension<AbsorberModExtension>().effectsAfterDirty;
public virtual ThingDef DirtyDef => def.GetModExtension<AbsorberModExtension>().dirtyDef; public virtual ThingDef DirtyDef => def.GetModExtension<AbsorberModExtension>().dirtyDef;
@ -206,12 +205,12 @@ namespace RJW_Menstruation
public Color fluidColor = Color.white; public Color fluidColor = Color.white;
public virtual void DirtyEffect(int tickInterval) { } public virtual void DirtyEffect() { }
public virtual void WearEffect(int tickInterval) public virtual void WearEffect()
{ {
absorbedfluids += PassiveAbsorptionPerHour * tickInterval / GenDate.TicksPerHour; absorbedfluids += 0.1f;
if (dirty) wearTicks += tickInterval; if (dirty) wearhours++;
} }
public override Color DrawColorTwo => fluidColor; public override Color DrawColorTwo => fluidColor;
@ -219,27 +218,26 @@ namespace RJW_Menstruation
public override void ExposeData() public override void ExposeData()
{ {
base.ExposeData(); base.ExposeData();
if(Scribe.mode == LoadSaveMode.LoadingVars) Scribe_Values.Look(ref absorbedfluids, "absorbedfluids", absorbedfluids, true);
{ Scribe_Values.Look(ref dirty, "dirty", dirty, true);
int wearhours = -1; Scribe_Values.Look(ref wearhours, "wearhours", wearhours, true);
Scribe_Values.Look(ref wearhours, "wearhours", wearhours, true); Scribe_Values.Look(ref fluidColor, "fluidColor", fluidColor, true);
if (wearhours >= 0) wearTicks = wearhours * GenDate.TicksPerHour;
}
Scribe_Values.Look(ref absorbedfluids, "absorbedfluids", 0);
Scribe_Values.Look(ref dirty, "dirty", false);
Scribe_Values.Look(ref wearTicks, "wearTicks", 0);
Scribe_Values.Look(ref fluidColor, "fluidColor", Color.white);
} }
} }
public class Absorber_Tampon : Absorber public class Absorber_Tampon : Absorber
{ {
protected override float PassiveAbsorptionPerHour => 0.5f;
public override void DirtyEffect(int tickInterval)
{
if (wearTicks > MinHrstoDirtyEffect * GenDate.TicksPerHour && Rand.MTBEventOccurs(100.0f, GenDate.TicksPerHour, tickInterval) && !Wearer.apparel.IsLocked(this)) public override void WearEffect()
{
if (dirty) wearhours++;
absorbedfluids += 0.5f;
}
public override void DirtyEffect()
{
if (wearhours > MinHrstoDirtyEffect && Rand.Chance(0.01f) && !Wearer.apparel.IsLocked(this))
{ {
Wearer.health.AddHediff(HediffDefOf.WoundInfection, Genital_Helper.get_genitalsBPR(Wearer)); Wearer.health.AddHediff(HediffDefOf.WoundInfection, Genital_Helper.get_genitalsBPR(Wearer));
} }
@ -256,7 +254,7 @@ namespace RJW_Menstruation
public override void ExposeData() public override void ExposeData()
{ {
base.ExposeData(); base.ExposeData();
Scribe_Values.Look(ref color, "color", Color.white); Scribe_Values.Look(ref color, "color", color, true);
} }
public override Color DrawColor public override Color DrawColor

View file

@ -60,12 +60,6 @@ namespace RJW_Menstruation
public static readonly string Option6_Desc = "Option6_Desc".Translate(); public static readonly string Option6_Desc = "Option6_Desc".Translate();
public static readonly string Option7_Label = "Option7_Label".Translate(); public static readonly string Option7_Label = "Option7_Label".Translate();
public static readonly string Option7_Desc = "Option7_Desc".Translate(); public static readonly string Option7_Desc = "Option7_Desc".Translate();
public static readonly string Option_ColonistUpdateInterval_Label = "Option_ColonistUpdateInterval_Label".Translate();
public static readonly string Option_ColonistUpdateInterval_Desc = "Option_ColonistUpdateInterval_Desc".Translate();
public static readonly string Option_NonColonistUpdateInterval_Label = "Option_NonColonistUpdateInterval_Label".Translate();
public static readonly string Option_NonColonistUpdateInterval_Desc = "Option_NonColonistUpdateInterval_Desc".Translate();
public static readonly string Option_AnimalUpdateInterval_Label = "Option_AnimalUpdateInterval_Label".Translate();
public static readonly string Option_AnimalUpdateInterval_Desc = "Option_AnimalUpdateInterval_Desc".Translate();
public static readonly string Option8_Label = "Option8_Label".Translate(); public static readonly string Option8_Label = "Option8_Label".Translate();
public static readonly string Option8_Desc = "Option8_Desc".Translate(); public static readonly string Option8_Desc = "Option8_Desc".Translate();
public static readonly string Option9_Label = "Option9_Label".Translate(); public static readonly string Option9_Label = "Option9_Label".Translate();

View file

@ -433,7 +433,7 @@ namespace RJW_Menstruation
float statvalue; float statvalue;
const float height = 24f; const float height = 24f;
statvalue = pawn.GetStatValue(xxx.sex_drive_stat); statvalue = pawn.GetStatValue(xxx.sex_drive_stat);
FillableBarLabeled(lineRect, " " + xxx.sex_drive_stat.LabelCap.CapitalizeFirst() + " " + statvalue.ToStringPercent(), statvalue / 2, TextureCache.OvulatoryTexture, Texture2D.blackTexture, xxx.sex_drive_stat.description); FillableBarLabeled(lineRect, " " + xxx.sex_drive_stat.LabelCap.CapitalizeFirst() + " " + statvalue.ToStringPercent(), statvalue / 2, TextureCache.SexDriveTexture, Texture2D.blackTexture, xxx.sex_drive_stat.description);
lineRect.y += height; lineRect.y += height;
statvalue = pawn.GetStatValue(xxx.vulnerability_stat); statvalue = pawn.GetStatValue(xxx.vulnerability_stat);
@ -462,8 +462,8 @@ namespace RJW_Menstruation
statvalue = Configurations.ImplantationChance * comp.ImplantChance; statvalue = Configurations.ImplantationChance * comp.ImplantChance;
float fertchance = comp.GetFertilityChance(); float fertchance = comp.GetFertilityChance();
FillableBarLabeled(lineRect, " " + xxx.reproduction.LabelCap.CapitalizeFirst() + " " + statvalue.ToStringPercent(), statvalue, TextureCache.LutealTexture, Texture2D.blackTexture, Translations.FertilityDesc(string.Format("{0:0.##}", fertchance * 100))); FillableBarLabeled(lineRect, " " + xxx.reproduction.LabelCap.CapitalizeFirst() + " " + statvalue.ToStringPercent(), statvalue, TextureCache.LutealTexture, Texture2D.blackTexture, Translations.FertilityDesc(string.Format("{0:0.##}", fertchance * 100)));
Rect overlayRect = new Rect(lineRect.x, lineRect.y, lineRect.width * Math.Min(1.0f, fertchance), lineRect.height); Rect overayRect = new Rect(lineRect.x, lineRect.y, lineRect.width * Math.Min(1.0f, fertchance), lineRect.height);
GUI.DrawTexture(overlayRect, TextureCache.FertChanceTex); GUI.DrawTexture(overayRect, TextureCache.FertChanceTex);
lineRect.y += height; lineRect.y += height;
} }

View file

@ -5,7 +5,7 @@ namespace RJW_Menstruation
{ {
public class Gizmo_Womb : Command_Action public class Gizmo_Womb : Command_Action
{ {
public Texture2D icon_overlay; public Texture2D icon_overay;
public Color cumcolor; public Color cumcolor;
public HediffComp_Menstruation comp; public HediffComp_Menstruation comp;
@ -14,23 +14,23 @@ namespace RJW_Menstruation
public override void DrawIcon(Rect rect, Material buttonMat, GizmoRenderParms parms) public override void DrawIcon(Rect rect, Material buttonMat, GizmoRenderParms parms)
{ {
Texture badTex = icon; Texture badTex = icon;
Texture2D overlay = icon_overlay; Texture2D overay = icon_overay;
Color color = cumcolor; Color color = cumcolor;
if (badTex == null) if (badTex == null)
{ {
badTex = BaseContent.BadTex; badTex = BaseContent.BadTex;
} }
if (overlay == null) if (overay == null)
{ {
overlay = BaseContent.BadTex; overay = BaseContent.BadTex;
} }
if (color == null) color = Color.white; if (color == null) color = Color.white;
rect.position += new Vector2(iconOffset.x * rect.size.x, iconOffset.y * rect.size.y); rect.position += new Vector2(iconOffset.x * rect.size.x, iconOffset.y * rect.size.y);
GUI.color = IconDrawColor; GUI.color = IconDrawColor;
Widgets.DrawTextureFitted(rect, badTex, this.iconDrawScale * 0.85f, this.iconProportions, this.iconTexCoords, this.iconAngle, buttonMat); Widgets.DrawTextureFitted(rect, badTex, this.iconDrawScale * 0.85f, this.iconProportions, this.iconTexCoords, this.iconAngle, buttonMat);
GUI.color = color; GUI.color = color;
Widgets.DrawTextureFitted(rect, overlay, iconDrawScale * 0.85f, iconProportions, iconTexCoords, iconAngle, buttonMat); Widgets.DrawTextureFitted(rect, overay, iconDrawScale * 0.85f, iconProportions, iconTexCoords, iconAngle, buttonMat);
GUI.color = Color.white; GUI.color = Color.white;
if (Configurations.DrawEggOverlay) comp.DrawEggOverlay(rect, false); if (Configurations.DrawEggOverlay) comp.DrawEggOverlay(rect, false);
Rect progressRect = new Rect(rect.x + 2f, rect.y, rect.width - 4f, progressbarHeight); Rect progressRect = new Rect(rect.x + 2f, rect.y, rect.width - 4f, progressbarHeight);

View file

@ -53,7 +53,7 @@ namespace RJW_Menstruation
if (pawn.kindDef?.race == pawn.def) return pawn.kindDef; if (pawn.kindDef?.race == pawn.def) return pawn.kindDef;
return VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def && kind.defName.Contains("Colonist")) ?? return VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def && kind.defName.Contains("Colonist")) ??
VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def) ?? VariousDefOf.AllKinds.Find(kind => kind.race == pawn.def) ??
pawn.RaceProps?.AnyPawnKind ?? pawn.def.race?.AnyPawnKind ??
pawn.kindDef; pawn.kindDef;
} }
@ -433,7 +433,7 @@ namespace RJW_Menstruation
} }
public static float LerpMultiple(this float a, float b, float t, float num) public static float LerpMultiple(this float a, float b, float t, int num)
{ {
float tmult = Mathf.Pow(1 - t, num); float tmult = Mathf.Pow(1 - t, num);
return tmult * a + (1 - tmult) * b; return tmult * a + (1 - tmult) * b;

View file

@ -167,10 +167,5 @@ namespace RJW_Menstruation
public static readonly HediffDef Hediff_Lactating_Permanent = DefDatabase<HediffDef>.GetNamedSilentFail("Lactating_Permanent"); public static readonly HediffDef Hediff_Lactating_Permanent = DefDatabase<HediffDef>.GetNamedSilentFail("Lactating_Permanent");
public static readonly HediffDef Hediff_Heavy_Lactating_Permanent = DefDatabase<HediffDef>.GetNamedSilentFail("Heavy_Lactating_Permanent"); public static readonly HediffDef Hediff_Heavy_Lactating_Permanent = DefDatabase<HediffDef>.GetNamedSilentFail("Heavy_Lactating_Permanent");
public static readonly JobDef Job_LactateSelf_MC = DefDatabase<JobDef>.GetNamedSilentFail("LactateSelf_MC"); public static readonly JobDef Job_LactateSelf_MC = DefDatabase<JobDef>.GetNamedSilentFail("LactateSelf_MC");
// Defs from Sexperience Ideology
public static readonly PreceptDef Pregnancy_Elevated = DefDatabase<PreceptDef>.GetNamedSilentFail("Pregnancy_Elevated");
public static readonly PreceptDef Pregnancy_Holy = DefDatabase<PreceptDef>.GetNamedSilentFail("Pregnancy_Holy");
public static readonly PreceptDef Pregnancy_Required = DefDatabase<PreceptDef>.GetNamedSilentFail("Pregnancy_Required");
} }
} }

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Manifest> <Manifest>
<identifier>RJW Menstruation</identifier> <identifier>RJW Menstruation</identifier>
<version>1.0.9.0</version> <version>1.0.8.9</version>
<dependencies> <dependencies>
</dependencies> </dependencies>
<incompatibleWith /> <incompatibleWith />

View file

@ -1,11 +1,3 @@
Version 1.0.9.0
- Fix errors when opening the womb dialog of some low fertility pawns.
- Updated Traditional Chinese translation by Hydrogen.
- New options to update wombs more or less often, defaulting to every hour.
- When using the sexperience-ideology mod, pawns with pro-pregnancy precepts will have thoughts more agreeable with potential pregnancies.
- More generous egg allocation for newly spawned periodic ovulators.
- Menstruation-related genes will now stay on females during initial pawn setup.
Version 1.0.8.9 Version 1.0.8.9
- Fix bug that sent pawns into menopause very early. Please use the recalculate ovary power dev action to restore lost eggs. - Fix bug that sent pawns into menopause very early. Please use the recalculate ovary power dev action to restore lost eggs.