Display ovaries at a lower state when ovulation chance is lower

This commit is contained in:
lutepickle 2023-03-06 17:35:11 -08:00
parent 2bb0871919
commit 1aaaf50b64
2 changed files with 11 additions and 3 deletions

Binary file not shown.

View File

@ -1,4 +1,5 @@
using RimWorld; using RimWorld;
using RimWorld.Planet;
using rjw; using rjw;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -218,6 +219,8 @@ namespace RJW_Menstruation
} }
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:
@ -228,15 +231,20 @@ namespace RJW_Menstruation
job.Sexprops != null && job.Sexprops != null &&
!job.Sexprops.usedCondom && !job.Sexprops.usedCondom &&
(job.Sexprops.sexType == xxx.rjwSextype.Vaginal || job.Sexprops.sexType == xxx.rjwSextype.DoublePenetration)) (job.Sexprops.sexType == xxx.rjwSextype.Vaginal || job.Sexprops.sexType == xxx.rjwSextype.DoublePenetration))
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_01", true); return ContentFinder<Texture2D>.Get((comp.OvulationChance >= ovaryChanceToShow_01) ? "Ovaries/Ovary_01" : "Ovaries_Ovary_00", true);
else break; else break;
} }
if (comp.curStageHrs > comp.CurStageIntervalHours - 30) // Approximate time for ovulation to occur if (comp.curStageHrs > comp.CurStageIntervalHours - 30) // Approximate time for ovulation to occur
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_01", true); return ContentFinder<Texture2D>.Get((comp.OvulationChance >= ovaryChanceToShow_01) ? "Ovaries/Ovary_01" : "Ovaries_Ovary_00", true);
else break; else break;
case HediffComp_Menstruation.Stage.Ovulatory: case HediffComp_Menstruation.Stage.Ovulatory:
if (!includeOvary) break; if (!includeOvary) break;
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_02", true); 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 fertstage = comp.IsFertilized; int fertstage = comp.IsFertilized;