Fix null ref when bleeding 0, add debug action to clear out a womb.

This commit is contained in:
lutepickle 2022-04-17 21:39:18 -07:00
parent a2d676247a
commit 92d732992a
3 changed files with 15 additions and 1 deletions

Binary file not shown.

View file

@ -41,6 +41,11 @@ namespace RJW_Menstruation
p.GetMenstruationComp().curStage = HediffComp_Menstruation.Stage.Young; p.GetMenstruationComp().curStage = HediffComp_Menstruation.Stage.Young;
} }
*/ */
[DebugAction("RJW Menstruation", "Remove all cum from pawn's womb", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void RemoveCums(Pawn p)
{
p.GetMenstruationComp().RemoveAllCums();
}
[DebugAction("RJW Menstruation", "Add egg to pawn's next ovulation", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)] [DebugAction("RJW Menstruation", "Add egg to pawn's next ovulation", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void AddEgg(Pawn p) private static void AddEgg(Pawn p)
{ {

View file

@ -831,6 +831,14 @@ namespace RJW_Menstruation
return new CumMixture(parent.pawn, totalleak, cumlabels, color, mixtureDef, pure); return new CumMixture(parent.pawn, totalleak, cumlabels, color, mixtureDef, pure);
} }
/// <summary>
/// Debug: Remove all cums from a womb
/// </summary>
public void RemoveAllCums()
{
cums.Clear();
}
/// <summary> /// <summary>
/// Fertilize eggs and return the result /// Fertilize eggs and return the result
@ -1138,7 +1146,8 @@ namespace RJW_Menstruation
{ {
//FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, ThingDefOf.Filth_Blood,parent.pawn.Label); //FilthMaker.TryMakeFilth(parent.pawn.Position, parent.pawn.Map, ThingDefOf.Filth_Blood,parent.pawn.Label);
CumIn(parent.pawn, Rand.Range(0.02f * Configurations.BleedingAmount, 0.04f * Configurations.BleedingAmount), Translations.Menstrual_Blood, -5.0f, parent.pawn.def.race?.BloodDef ?? ThingDefOf.Filth_Blood); CumIn(parent.pawn, Rand.Range(0.02f * Configurations.BleedingAmount, 0.04f * Configurations.BleedingAmount), Translations.Menstrual_Blood, -5.0f, parent.pawn.def.race?.BloodDef ?? ThingDefOf.Filth_Blood);
GetNotCum(Translations.Menstrual_Blood).Color = BloodColor; Cum blood = GetNotCum(Translations.Menstrual_Blood);
if (blood != null) blood.Color = BloodColor;
} }
/// <summary> /// <summary>