mirror of
https://gitgud.io/lutepickle/rjw_menstruation.git
synced 2024-08-14 22:46:52 +00:00
Catch attempting to tick uninitialized wombs
This commit is contained in:
parent
0e8c025429
commit
003f5d6d29
2 changed files with 13 additions and 0 deletions
Binary file not shown.
|
@ -72,6 +72,7 @@ namespace RJW_Menstruation
|
||||||
public Stage curStage = Stage.Follicular;
|
public Stage curStage = Stage.Follicular;
|
||||||
public int curStageHrs = 0;
|
public int curStageHrs = 0;
|
||||||
public bool loaded = false;
|
public bool loaded = false;
|
||||||
|
public bool initError = false;
|
||||||
public int ovarypower = -100000;
|
public int ovarypower = -100000;
|
||||||
public int eggstack = 0;
|
public int eggstack = 0;
|
||||||
public bool DoCleanWomb = false;
|
public bool DoCleanWomb = false;
|
||||||
|
@ -610,6 +611,13 @@ namespace RJW_Menstruation
|
||||||
// If an exception makes it out, RW will remove the hediff, so catch it here
|
// If an exception makes it out, RW will remove the hediff, so catch it here
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Initialize immediately if needed, but if there's an error, then don't spam it every tick
|
||||||
|
if (!loaded && !initError)
|
||||||
|
{
|
||||||
|
Log.Warning($"{Pawn}'s womb is ticking, but was not initialized first");
|
||||||
|
Initialize();
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!Pawn.IsHashIntervalTick(tickInterval) ||
|
!Pawn.IsHashIntervalTick(tickInterval) ||
|
||||||
!ShouldSimulate()
|
!ShouldSimulate()
|
||||||
|
@ -618,6 +626,8 @@ namespace RJW_Menstruation
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (initError) Log.Warning($"Attempting to process {Pawn}'s womb uninitialized");
|
||||||
|
|
||||||
if (Pregnancy != null && curStage != Stage.Pregnant)
|
if (Pregnancy != null && curStage != Stage.Pregnant)
|
||||||
{
|
{
|
||||||
Log.Warning($"{Pawn}'s womb has a pregnancy, but was not in the pregnant stage");
|
Log.Warning($"{Pawn}'s womb has a pregnancy, but was not in the pregnant stage");
|
||||||
|
@ -994,6 +1004,7 @@ namespace RJW_Menstruation
|
||||||
|
|
||||||
public void Initialize()
|
public void Initialize()
|
||||||
{
|
{
|
||||||
|
initError = true;
|
||||||
Props = (CompProperties_Menstruation)props;
|
Props = (CompProperties_Menstruation)props;
|
||||||
|
|
||||||
if (Props.infertile)
|
if (Props.infertile)
|
||||||
|
@ -1001,6 +1012,7 @@ namespace RJW_Menstruation
|
||||||
if (cums == null) cums = new List<Cum>();
|
if (cums == null) cums = new List<Cum>();
|
||||||
curStage = Stage.None;
|
curStage = Stage.None;
|
||||||
loaded = true;
|
loaded = true;
|
||||||
|
initError = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1028,6 +1040,7 @@ namespace RJW_Menstruation
|
||||||
|
|
||||||
//Log.Message(Pawn.Label + " - Initialized menstruation comp");
|
//Log.Message(Pawn.Label + " - Initialized menstruation comp");
|
||||||
loaded = true;
|
loaded = true;
|
||||||
|
initError = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual float RaceCyclesPerYear()
|
protected virtual float RaceCyclesPerYear()
|
||||||
|
|
Loading…
Reference in a new issue