Move the hash interval to the start of CompPostTick, since ShouldSimulate is getting heavy

This commit is contained in:
lutepickle 2023-12-04 11:44:45 -08:00
parent 0e708c6c89
commit dc33024d42
2 changed files with 4 additions and 8 deletions

View File

@ -739,6 +739,9 @@ namespace RJW_Menstruation
// If an exception makes it out, RW will remove the hediff, so catch it here
try
{
if (Pawn.IsHashIntervalTick(recalculateTickInterval)) TickInterval = -1; // Every so often, force TickInterval to be recalculated in case the pawn's status changed.
if (!Pawn.IsHashIntervalTick(TickInterval)) return;
if (!ShouldSimulate()) return;
// Initialize immediately if needed, but if there's an error, then don't spam it every tick
@ -747,10 +750,7 @@ namespace RJW_Menstruation
Log.Warning($"{Pawn}'s womb is ticking, but was not initialized first");
Initialize();
}
if (Pawn.IsHashIntervalTick(recalculateTickInterval)) TickInterval = -1; // Every so often, force TickInterval to be recalculated in case the pawn's status changed.
if (!Pawn.IsHashIntervalTick(TickInterval)) return;
if (initError) Log.Warning($"Attempting to process {Pawn}'s womb uninitialized");
if (Pregnancy != null && curStage != Stage.Pregnant)

View File

@ -37,10 +37,6 @@ namespace RJW_Menstruation
if (t.Pawn == pawn && pawn.HasMenstruationComp()) opts.AddDistinct(MakeSelfMenu(pawn, t));
break;
}
}
public static FloatMenuOption MakeSelfMenu(Pawn pawn, LocalTargetInfo target)