Display ovaries on the womb dialog when near ovulation

This commit is contained in:
lutepickle 2022-05-31 18:14:11 -07:00
parent 4ce0574e0b
commit 5b784c3c59
8 changed files with 39 additions and 23 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View file

@ -155,40 +155,55 @@ namespace RJW_Menstruation
return wombtex;
}
public static Texture2D GetEggIcon(this HediffComp_Menstruation comp)
public static Texture2D GetEggIcon(this HediffComp_Menstruation comp, bool includeOvary)
{
if (comp.parent.pawn.IsPregnant(Configurations.InfoDetail != Configurations.DetailLevel.All))
{
if (comp.parent.pawn.GetPregnancyProgress() < 0.2f) return ContentFinder<Texture2D>.Get("Eggs/Egg_Implanted00", true);
else return ContentFinder<Texture2D>.Get("Womb/Empty", true);
}
else if (!comp.IsEggExist) return ContentFinder<Texture2D>.Get("Womb/Empty", true);
else
{
int fertstage = comp.IsFertilized;
if (fertstage >= 0)
{
if (fertstage <= 18) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized00", true);
else if (fertstage <= 36) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized01", true);
else return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized02", true);
}
else if (comp.IsEggFertilizing)
{
if (comp.GetFertilityChance() < 0.5f)
return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilizing00", true);
else
return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilizing01", true);
}
else return ContentFinder<Texture2D>.Get("Eggs/Egg", true);
switch(comp.curStage)
{
case HediffComp_Menstruation.Stage.Follicular:
case HediffComp_Menstruation.Stage.ClimactericFollicular:
if (!includeOvary) break;
if (comp is HediffComp_InducedOvulator) break;
if (comp.curStageHrs > comp.FollicularIntervalHours - 30) // Approximate time for ovulation to occur
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_01", true);
else break;
case HediffComp_Menstruation.Stage.Ovulatory:
if (!includeOvary) break;
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_02", true);
case HediffComp_Menstruation.Stage.Luteal:
case HediffComp_Menstruation.Stage.ClimactericLuteal:
if (!comp.IsEggExist) break;
int fertstage = comp.IsFertilized;
if (fertstage >= 0)
{
if (fertstage <= Math.Max(comp.CycleFactor, 24.0f)) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilizing02", true);
if (fertstage <= 18) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized00", true);
else if (fertstage <= 54) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized01", true);
else return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized02", true);
}
else if (comp.IsEggFertilizing)
{
if (comp.GetFertilityChance() < 0.5f)
return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilizing00", true);
else
return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilizing01", true);
}
else return ContentFinder<Texture2D>.Get("Eggs/Egg", true);
}
return ContentFinder<Texture2D>.Get("Womb/Empty", true);
}
public static void DrawEggOverlay(this HediffComp_Menstruation comp, Rect wombRect)
public static void DrawEggOverlay(this HediffComp_Menstruation comp, Rect wombRect, bool includeOvary)
{
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);
GUI.DrawTexture(rect, comp.GetEggIcon(includeOvary), ScaleMode.ScaleToFit);
}

View file

@ -242,7 +242,7 @@ namespace RJW_Menstruation
if (Configurations.DrawEggOverlay)
{
comp.DrawEggOverlay(wombRect);
comp.DrawEggOverlay(wombRect, true);
}

View file

@ -32,7 +32,7 @@ namespace RJW_Menstruation
GUI.color = color;
Widgets.DrawTextureFitted(rect, overay, iconDrawScale * 0.85f, iconProportions, iconTexCoords, iconAngle, buttonMat);
GUI.color = Color.white;
if (Configurations.DrawEggOverlay) comp.DrawEggOverlay(rect);
if (Configurations.DrawEggOverlay) comp.DrawEggOverlay(rect, false);
Rect progressRect = new Rect(rect.x + 2f, rect.y, rect.width - 4f, progressbarHeight);
Widgets.FillableBar(progressRect, comp.StageProgress, comp.GetStageTexture);

View file

@ -1,6 +1,7 @@
Version 1.0.6.5
- Handle climacteric induced ovulators a bit better.
- Add a brief description when mousing over the current phase in the womb dialog.
- Add an ovary image to the womb status dialog (but not the little icon) when ovulation is imminent or occuring.
Version 1.0.6.4
- Fix a bug with pawns not being generated.