mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Display the ovulation graphics going through the ovulation stage instead of at the end of follicular
This commit is contained in:
parent
a38d81424a
commit
6344a7c7ad
2 changed files with 28 additions and 22 deletions
Binary file not shown.
|
@ -3,6 +3,7 @@ using RimWorld.Planet;
|
|||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Eventing.Reader;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
@ -217,35 +218,36 @@ namespace RJW_Menstruation
|
|||
|
||||
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)
|
||||
{
|
||||
float ovulationChance = comp.OvulationChance;
|
||||
const float ovaryChanceToShow_01 = 0.4f;
|
||||
const float ovaryChanceToShow_02 = 1.0f;
|
||||
switch (comp.CurrentVisibleStage)
|
||||
{
|
||||
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((ovulationChance >= ovaryChanceToShow_01) ? "Ovaries/Ovary_01" : "Ovaries/Ovary_00", true);
|
||||
else break;
|
||||
}
|
||||
if (comp.curStageTicks > comp.CurStageIntervalTicks - 30 * GenDate.TicksPerHour) // Approximate time for ovulation to occur
|
||||
return ContentFinder<Texture2D>.Get((ovulationChance >= ovaryChanceToShow_01) ? "Ovaries/Ovary_01" : "Ovaries/Ovary_00", true);
|
||||
else break;
|
||||
case HediffComp_Menstruation.Stage.Ovulatory:
|
||||
if (!includeOvary) break;
|
||||
if (ovulationChance >= ovaryChanceToShow_02)
|
||||
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_02", true);
|
||||
else if (ovulationChance >= ovaryChanceToShow_01)
|
||||
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_01", true);
|
||||
else
|
||||
return ContentFinder<Texture2D>.Get("Ovaries/Ovary_00", true);
|
||||
else return GetOvaryIcon(comp);
|
||||
case HediffComp_Menstruation.Stage.Luteal:
|
||||
if (!comp.IsEggExist) break;
|
||||
int fertTime = comp.EggFertilizedTime;
|
||||
|
@ -256,6 +258,10 @@ namespace RJW_Menstruation
|
|||
else if (fertTime <= 54 * GenDate.TicksPerHour) return ContentFinder<Texture2D>.Get("Eggs/Egg_Fertilized01", 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)
|
||||
{
|
||||
if (comp.GetFertilityChance() < 0.5f)
|
||||
|
|
Loading…
Reference in a new issue