Support for multiple vaginas

This commit is contained in:
lutepickle 2022-07-11 11:52:27 -07:00
parent 20692aaf13
commit 699c91106f
16 changed files with 106 additions and 106 deletions

Binary file not shown.

View file

@ -9,28 +9,32 @@ namespace RJW_Menstruation
[DebugAction("RJW Menstruation", "Set pawn's state to follicular", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)] [DebugAction("RJW Menstruation", "Set pawn's state to follicular", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void SetFollicular(Pawn p) private static void SetFollicular(Pawn p)
{ {
p.GetMenstruationComp().curStage = HediffComp_Menstruation.Stage.Follicular; foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
comp.curStage = HediffComp_Menstruation.Stage.Follicular;
Messages.Message($"{p} is now follicular", MessageTypeDefOf.NeutralEvent, false); Messages.Message($"{p} is now follicular", MessageTypeDefOf.NeutralEvent, false);
} }
[DebugAction("RJW Menstruation", "Set pawn's state to ovulatory", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)] [DebugAction("RJW Menstruation", "Set pawn's state to ovulatory", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void SetOvulatory(Pawn p) private static void SetOvulatory(Pawn p)
{ {
p.GetMenstruationComp().curStage = HediffComp_Menstruation.Stage.Ovulatory; foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
comp.curStage = HediffComp_Menstruation.Stage.Ovulatory;
Messages.Message($"{p} is now ovulatory", MessageTypeDefOf.NeutralEvent, false); Messages.Message($"{p} is now ovulatory", MessageTypeDefOf.NeutralEvent, false);
} }
[DebugAction("RJW Menstruation", "Set pawn's state to luteal", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)] [DebugAction("RJW Menstruation", "Set pawn's state to luteal", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void SetLuteal(Pawn p) private static void SetLuteal(Pawn p)
{ {
p.GetMenstruationComp().curStage = HediffComp_Menstruation.Stage.Luteal; foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
comp.curStage = HediffComp_Menstruation.Stage.Luteal;
Messages.Message($"{p} is now luteal", MessageTypeDefOf.NeutralEvent, false); Messages.Message($"{p} is now luteal", MessageTypeDefOf.NeutralEvent, false);
} }
[DebugAction("RJW Menstruation", "Set pawn's state to bleeding", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)] [DebugAction("RJW Menstruation", "Set pawn's state to bleeding", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void SetBleeding(Pawn p) private static void SetBleeding(Pawn p)
{ {
p.GetMenstruationComp().curStage = HediffComp_Menstruation.Stage.Bleeding; foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
comp.curStage = HediffComp_Menstruation.Stage.Bleeding;
Messages.Message($"{p} is now bleeding", MessageTypeDefOf.NeutralEvent, false); Messages.Message($"{p} is now bleeding", MessageTypeDefOf.NeutralEvent, false);
} }
/* /*
@ -49,21 +53,24 @@ namespace RJW_Menstruation
[DebugAction("RJW Menstruation", "Remove all cum from pawn's womb", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)] [DebugAction("RJW Menstruation", "Remove all cum from pawn's womb", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void RemoveCums(Pawn p) private static void RemoveCums(Pawn p)
{ {
p.GetMenstruationComp().RemoveAllCums(); foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
comp.RemoveAllCums();
Messages.Message($"All cum removed from {p}'s womb", MessageTypeDefOf.NeutralEvent, false); Messages.Message($"All cum removed from {p}'s womb", MessageTypeDefOf.NeutralEvent, false);
} }
[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)
{ {
p.GetMenstruationComp().eggstack++; foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
Messages.Message($"1 egg added to {p}'s next ovulation ({p.GetMenstruationComp().eggstack})", MessageTypeDefOf.NeutralEvent, false); comp.eggstack++;
Messages.Message($"1 egg added to {p}'s next ovulation ({p.GetFirstMenstruationComp().eggstack})", MessageTypeDefOf.NeutralEvent, false);
} }
[DebugAction("RJW Menstruation", "Recalculate pawn's ovary power", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)] [DebugAction("RJW Menstruation", "Recalculate pawn's ovary power", false, false, actionType = DebugActionType.ToolMapForPawns, allowedGameStates = AllowedGameStates.Playing)]
private static void RecalculateOvaryPower(Pawn p) private static void RecalculateOvaryPower(Pawn p)
{ {
p.GetMenstruationComp().ovarypower = p.GetMenstruationComp().GetOvaryPowerByAge(); foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
Messages.Message($"{p}'s ovarypower recalculated ({p.GetMenstruationComp().ovarypower})", MessageTypeDefOf.NeutralEvent, false); comp.ovarypower = comp.GetOvaryPowerByAge();
Messages.Message($"{p}'s ovarypower recalculated ({p.GetFirstMenstruationComp().ovarypower})", MessageTypeDefOf.NeutralEvent, false);
} }
} }
} }

View file

@ -10,13 +10,13 @@ namespace RJW_Menstruation
{ {
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested) protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{ {
HediffComp_Menstruation comp = pawn.GetMenstruationComp(); foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
if (comp != null && (comp.curStage.Equals(HediffComp_Menstruation.Stage.Follicular) if(comp.curStage.Equals(HediffComp_Menstruation.Stage.Follicular)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.Luteal) || comp.curStage.Equals(HediffComp_Menstruation.Stage.Luteal)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericFollicular) || comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericFollicular)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericLuteal) || comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericLuteal)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.Anestrus) || comp.curStage.Equals(HediffComp_Menstruation.Stage.Anestrus)
)) )
{ {
comp.SetEstrus(comp.Props.eggLifespanDays); comp.SetEstrus(comp.Props.eggLifespanDays);
comp.curStage = HediffComp_Menstruation.Stage.Ovulatory; comp.curStage = HediffComp_Menstruation.Stage.Ovulatory;
@ -29,11 +29,11 @@ namespace RJW_Menstruation
{ {
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested) protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{ {
HediffComp_Menstruation comp = pawn.GetMenstruationComp(); foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
if (comp != null && (comp.curStage.Equals(HediffComp_Menstruation.Stage.Follicular) if (comp.curStage.Equals(HediffComp_Menstruation.Stage.Follicular)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericFollicular) || comp.curStage.Equals(HediffComp_Menstruation.Stage.ClimactericFollicular)
|| comp.curStage.Equals(HediffComp_Menstruation.Stage.Anestrus) || comp.curStage.Equals(HediffComp_Menstruation.Stage.Anestrus)
)) )
{ {
comp.SetEstrus(comp.Props.eggLifespanDays); comp.SetEstrus(comp.Props.eggLifespanDays);
comp.curStage = HediffComp_Menstruation.Stage.Ovulatory; comp.curStage = HediffComp_Menstruation.Stage.Ovulatory;
@ -62,11 +62,8 @@ namespace RJW_Menstruation
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested) protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{ {
HediffComp_Menstruation comp = pawn.GetMenstruationComp(); foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
if (Configurations.EnableMenopause && comp != null) if (Configurations.EnableMenopause) comp.RecoverOvary(1 + effectOffset);
{
comp.RecoverOvary(1 + effectOffset);
}
} }
} }
@ -74,14 +71,9 @@ namespace RJW_Menstruation
{ {
protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested) protected override void DoIngestionOutcomeSpecial(Pawn pawn, Thing ingested)
{ {
HediffComp_Menstruation comp = pawn.GetMenstruationComp(); foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
if (comp != null)
{
comp.eggstack += Rand.Range(1, 4); comp.eggstack += Rand.Range(1, 4);
} }
}
} }
public class ContraceptiveOutcomeDoer : IngestionOutcomeDoer public class ContraceptiveOutcomeDoer : IngestionOutcomeDoer

View file

@ -188,7 +188,7 @@ namespace RJW_Menstruation
public override void CompPostPostRemoved() public override void CompPostPostRemoved()
{ {
HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(action); HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(action);
Log.Message(parent.pawn.Label + "breast tick scheduler removed"); Log.Message(parent.pawn.Label + " breast tick scheduler removed");
base.CompPostPostRemoved(); base.CompPostPostRemoved();
} }

View file

@ -543,7 +543,7 @@ namespace RJW_Menstruation
public override void CompPostPostRemoved() public override void CompPostPostRemoved()
{ {
HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(actionref); HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(actionref);
Log.Message(parent.pawn.Label + "tick scheduler removed"); Log.Message(parent.pawn.Label + " tick scheduler removed");
base.CompPostPostRemoved(); base.CompPostPostRemoved();
} }

View file

@ -12,22 +12,38 @@ namespace RJW_Menstruation
{ {
public static class MenstruationUtility public static class MenstruationUtility
{ {
[Obsolete("This method is obsolete. Use GetMenstruationComps or a related function instead", false)]
public static HediffComp_Menstruation GetMenstruationComp(this Pawn pawn) public static HediffComp_Menstruation GetMenstruationComp(this Pawn pawn)
{
return pawn.GetFirstMenstruationComp();
}
public static IEnumerable<HediffComp_Menstruation> GetMenstruationComps(this Pawn pawn)
{ {
var hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina")); var hedifflist = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn))?.FindAll((Hediff h) => h.def.defName.ToLower().Contains("vagina"));
HediffComp_Menstruation result; foreach (Hediff hediff in hedifflist)
if (hedifflist.NullOrEmpty()) return null;
else
{ {
foreach (Hediff h in hedifflist) HediffComp_Menstruation result = hediff.TryGetComp<HediffComp_Menstruation>();
{ if (result != null) yield return result;
result = h.TryGetComp<HediffComp_Menstruation>();
if (result != null) return result;
} }
} }
return null;
public static HediffComp_Menstruation GetFirstMenstruationComp(this Pawn pawn)
{
return pawn.GetMenstruationComps().FirstOrDefault();
}
public static HediffComp_Menstruation GetRandomMenstruationComp(this Pawn pawn)
{
return pawn.GetMenstruationComps().RandomElementWithFallback();
}
public static HediffComp_Menstruation GetFertileMenstruationComp(this Pawn pawn)
{
List<HediffComp_Menstruation> comps = pawn.GetMenstruationComps().ToList();
HediffComp_Menstruation comp = comps.Where(c => c.IsDangerDay).RandomElementWithFallback();
if (comp == null) return comps.RandomElementWithFallback();
else return comp;
} }
public static HediffComp_Menstruation GetMenstruationComp(this Hediff hediff) public static HediffComp_Menstruation GetMenstruationComp(this Hediff hediff)
@ -63,18 +79,11 @@ namespace RJW_Menstruation
return null; return null;
} }
public static float GetFertilityChance(this HediffComp_Menstruation comp) public static float GetFertilityChance(this HediffComp_Menstruation comp)
{ {
return 1.0f - Mathf.Pow(1.0f - Configurations.FertilizeChance, comp.TotalFertCum * comp.Props.basefertilizationChanceFactor); return 1.0f - Mathf.Pow(1.0f - Configurations.FertilizeChance, comp.TotalFertCum * comp.Props.basefertilizationChanceFactor);
} }
public static HediffComp_Menstruation.Stage GetCurStage(this Pawn pawn)
{
return GetMenstruationComp(pawn)?.curStage ?? HediffComp_Menstruation.Stage.Bleeding;
}
public static Texture2D GetPregnancyIcon(this HediffComp_Menstruation comp, Hediff hediff) public static Texture2D GetPregnancyIcon(this HediffComp_Menstruation comp, Hediff hediff)
{ {
string icon = ""; string icon = "";

View file

@ -1,4 +1,5 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using RimWorld; using RimWorld;
using Verse; using Verse;
using Verse.AI; using Verse.AI;
@ -16,11 +17,10 @@ namespace RJW_Menstruation
protected override IEnumerable<Toil> MakeNewToils() protected override IEnumerable<Toil> MakeNewToils()
{ {
List<HediffComp_Menstruation> comps = pawn.GetMenstruationComps().ToList();
HediffComp_Menstruation Comp = pawn.GetMenstruationComp();
this.FailOn(delegate this.FailOn(delegate
{ {
return !(Comp.TotalCumPercent > 0.001); return comps.All(comp => comp.TotalCumPercent < 0.001);
}); });
Toil excreting = Toils_General.Wait(excretingTime, TargetIndex.None);//duration of Toil excreting = Toils_General.Wait(excretingTime, TargetIndex.None);//duration of
@ -30,8 +30,9 @@ namespace RJW_Menstruation
{ {
initAction = delegate () initAction = delegate ()
{ {
Comp.CumOut(null, 0.5f); foreach (HediffComp_Menstruation comp in comps)
if (Comp.TotalCumPercent > 0.001) JumpToToil(excreting); comp.CumOut(null, 0.5f);
if (comps.Any(comp => comp.TotalCumPercent > 0.001)) JumpToToil(excreting);
} }
}; };
//yield return excreting; //yield return excreting;

View file

@ -29,8 +29,7 @@ namespace RJW_Menstruation.Patch
// foreach(Pawn p in PawnsFinder.All_AliveOrDead) // foreach(Pawn p in PawnsFinder.All_AliveOrDead)
foreach(Pawn p in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_OfPlayerFaction.Union(PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_PrisonersOfColony)) foreach(Pawn p in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_OfPlayerFaction.Union(PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_PrisonersOfColony))
{ {
HediffComp_Menstruation comp = p.GetMenstruationComp(); foreach (HediffComp_Menstruation comp in p.GetMenstruationComps())
if (comp is null) continue;
GetCriticalPawnReason_Patch.cummedPawns.UnionWith(comp.GetCummersAndFertilizers()); GetCriticalPawnReason_Patch.cummedPawns.UnionWith(comp.GetCummersAndFertilizers());
} }
} }

View file

@ -28,9 +28,7 @@ namespace RJW_Menstruation
foreach (Gizmo gizmo in gizmos) foreach (Gizmo gizmo in gizmos)
yield return gizmo; yield return gizmo;
HediffComp_Menstruation comp = __instance.GetMenstruationComp(); foreach (HediffComp_Menstruation comp in __instance.GetMenstruationComps())
if (comp == null) yield break;
foreach (Gizmo gizmo in GetMenstruationGizmos(__instance, comp)) foreach (Gizmo gizmo in GetMenstruationGizmos(__instance, comp))
yield return gizmo; yield return gizmo;
} }

View file

@ -16,20 +16,18 @@ namespace RJW_Menstruation
public static void Postfix(Pawn __instance) public static void Postfix(Pawn __instance)
{ {
//Log.Message("Initialize on spawnsetup"); //Log.Message("Initialize on spawnsetup");
HediffComp_Menstruation comp = __instance.GetMenstruationComp(); foreach (HediffComp_Menstruation comp in __instance.GetMenstruationComps())
if (comp != null)
{ {
HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(comp.actionref); HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(comp.actionref);
comp.Initialize(); comp.Initialize();
} }
HediffComp_Breast bcomp = __instance.GetBreastComp(); HediffComp_Breast bcomp = __instance.GetBreastComp();
if (bcomp != null) if (bcomp != null)
{ {
HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(bcomp.action); HugsLibController.Instance.TickDelayScheduler.TryUnscheduleCallback(bcomp.action);
bcomp.Initialize(); bcomp.Initialize();
} }
} }
} }

View file

@ -29,7 +29,10 @@ namespace RJW_Menstruation
var pawnparts = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn)); var pawnparts = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn));
HediffComp_Menstruation comp = partner.GetMenstruationComp(); HediffComp_Menstruation comp;
if (pawn.Has(Quirk.ImpregnationFetish) || partner.Has(Quirk.ImpregnationFetish) || partner.IsInEstrus())
comp = pawn.GetFertileMenstruationComp();
else comp = pawn.GetRandomMenstruationComp();
if (comp == null) return true; if (comp == null) return true;
if (Genital_Helper.has_penis_fertile(pawn, pawnparts) && PregnancyHelper.CanImpregnate(pawn, partner, sextype)) if (Genital_Helper.has_penis_fertile(pawn, pawnparts) && PregnancyHelper.CanImpregnate(pawn, partner, sextype))
@ -85,7 +88,10 @@ namespace RJW_Menstruation
public static bool Prefix(Pawn pawn, Pawn partner) // partner has vagina public static bool Prefix(Pawn pawn, Pawn partner) // partner has vagina
{ {
if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true; if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
HediffComp_Menstruation comp = partner.GetMenstruationComp(); HediffComp_Menstruation comp;
if (pawn.Has(Quirk.ImpregnationFetish) || partner.Has(Quirk.ImpregnationFetish) || partner.IsInEstrus())
comp = pawn.GetFertileMenstruationComp();
else comp = pawn.GetRandomMenstruationComp();
if (comp == null) if (comp == null)
{ {
ModLog.Message("used original rjw method: Comp missing"); ModLog.Message("used original rjw method: Comp missing");
@ -123,9 +129,9 @@ namespace RJW_Menstruation
// This is stricter than can_impregnate, so quickly filter out scenarios that are negative anyways. // This is stricter than can_impregnate, so quickly filter out scenarios that are negative anyways.
if (__result == false || __instance != Quirk.ImpregnationFetish) return; if (__result == false || __instance != Quirk.ImpregnationFetish) return;
__result = __result =
((PregnancyHelper.CanImpregnate(pawn, partner) && (partner.GetMenstruationComp()?.IsDangerDay ?? true)) (PregnancyHelper.CanImpregnate(pawn, partner) && (partner.GetMenstruationComps()?.Any(comp => comp.IsDangerDay) ?? true))
|| ||
(PregnancyHelper.CanImpregnate(partner, pawn) && (pawn.GetMenstruationComp()?.IsDangerDay ?? true))); (PregnancyHelper.CanImpregnate(partner, pawn) && (pawn.GetMenstruationComps()?.Any(comp => comp.IsDangerDay) ?? true));
} }
} }
@ -144,9 +150,9 @@ namespace RJW_Menstruation
else __result--; else __result--;
if ( if (
(PregnancyHelper.CanImpregnate(pawn, partner, props.sexType) && (partner.GetMenstruationComp()?.IsDangerDay ?? true)) (PregnancyHelper.CanImpregnate(pawn, partner, props.sexType) && (partner.GetMenstruationComps()?.Any(comp => comp.IsDangerDay) ?? true))
|| ||
(PregnancyHelper.CanImpregnate(partner, pawn, props.sexType) && (pawn.GetMenstruationComp()?.IsDangerDay ?? true))) (PregnancyHelper.CanImpregnate(partner, pawn, props.sexType) && (pawn.GetMenstruationComps()?.Any(comp => comp.IsDangerDay) ?? true)))
__result++; __result++;
} }
} }

View file

@ -92,7 +92,7 @@ namespace RJW_Menstruation
int index = pawns.IndexOf(window.pawn); int index = pawns.IndexOf(window.pawn);
SoundDefOf.TabOpen.PlayOneShotOnCamera(); SoundDefOf.TabOpen.PlayOneShotOnCamera();
Pawn newpawn = pawns[(index + 1) % pawns.Count]; Pawn newpawn = pawns[(index + 1) % pawns.Count];
window.ChangePawn(newpawn, newpawn.GetMenstruationComp()); window.ChangePawn(newpawn, newpawn.GetFirstMenstruationComp());
} }
else if (window.pawn != pawn) else if (window.pawn != pawn)
{ {

View file

@ -23,8 +23,6 @@ namespace RJW_Menstruation.Sexperience
protected override IEnumerable<Toil> MakeNewToils() protected override IEnumerable<Toil> MakeNewToils()
{ {
HediffComp_Menstruation Comp = pawn.GetMenstruationComp();
//this.FailOn(delegate //this.FailOn(delegate
//{ //{
// return !(Comp.TotalCumPercent > 0.001); // return !(Comp.TotalCumPercent > 0.001);
@ -38,9 +36,11 @@ namespace RJW_Menstruation.Sexperience
{ {
initAction = delegate () initAction = delegate ()
{ {
if (Comp.TotalCumPercent > 0.001) bool anyExcreted = false;
foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
if (comp.TotalCumPercent > 0.001)
{ {
CumMixture mixture = Comp.MixtureOut(RJWSexperience.VariousDefOf.GatheredCum, 0.5f); CumMixture mixture = comp.MixtureOut(RJWSexperience.VariousDefOf.GatheredCum, 0.5f);
float amount = mixture.Volume; float amount = mixture.Volume;
if (mixture.ispurecum) if (mixture.ispurecum)
{ {
@ -52,9 +52,10 @@ namespace RJW_Menstruation.Sexperience
cummixture.InitwithCum(mixture); cummixture.InitwithCum(mixture);
Bucket.AddCum(amount, cummixture); Bucket.AddCum(amount, cummixture);
} }
anyExcreted = true;
} }
else ReadyForNextToil(); if (!anyExcreted) ReadyForNextToil();
if (Comp.TotalCumPercent > 0.001) JumpToToil(excreting); if (pawn.GetMenstruationComps().Any(c => c.TotalCumPercent > 0.001)) JumpToToil(excreting);
} }
}; };

View file

@ -18,9 +18,8 @@ namespace RJW_Menstruation.Sexperience
public static void Postfix(Vector3 clickPos, Pawn pawn, List<FloatMenuOption> opts) public static void Postfix(Vector3 clickPos, Pawn pawn, List<FloatMenuOption> opts)
{ {
var targets = GenUI.TargetsAt(clickPos, TargetingParameters.ForBuilding()); var targets = GenUI.TargetsAt(clickPos, TargetingParameters.ForBuilding());
HediffComp_Menstruation comp = pawn.GetMenstruationComp();
if (comp != null && comp.TotalCumPercent > 0.001f) if (pawn.GetMenstruationComps().Any(comp => comp.TotalCumPercent > 0.001f))
foreach (LocalTargetInfo t in targets) foreach (LocalTargetInfo t in targets)
{ {
if (t.Thing is Building building) if (t.Thing is Building building)
@ -32,10 +31,6 @@ namespace RJW_Menstruation.Sexperience
} }
} }
} }
} }
public static FloatMenuOption MakeMenu(Pawn pawn, LocalTargetInfo target) public static FloatMenuOption MakeMenu(Pawn pawn, LocalTargetInfo target)

View file

@ -20,8 +20,7 @@ namespace RJW_Menstruation.Sexperience
[HarmonyPatch("HasJobOnThing")] [HarmonyPatch("HasJobOnThing")]
public static bool HasJobOnThing(Pawn pawn, ref bool __result) public static bool HasJobOnThing(Pawn pawn, ref bool __result)
{ {
HediffComp_Menstruation comp = pawn.GetMenstruationComp(); if (pawn.GetMenstruationComps().Any(comp => comp.DoCleanWomb && comp.TotalCumPercent > 0.001f) && pawn.Map.listerBuildings.ColonistsHaveBuilding(VariousDefOf.CumBucket))
if (comp != null && comp.DoCleanWomb && comp.TotalCumPercent > 0.001f && pawn.Map.listerBuildings.ColonistsHaveBuilding(VariousDefOf.CumBucket))
{ {
__result = true; __result = true;
return false; return false;
@ -33,8 +32,7 @@ namespace RJW_Menstruation.Sexperience
[HarmonyPatch("JobOnThing")] [HarmonyPatch("JobOnThing")]
public static void JobOnThing(Pawn pawn, ref Job __result) public static void JobOnThing(Pawn pawn, ref Job __result)
{ {
HediffComp_Menstruation comp = pawn.GetMenstruationComp(); if (pawn.GetMenstruationComps().Any(comp => comp.DoCleanWomb && comp.TotalCumPercent > 0.001f))
if (comp != null && comp.DoCleanWomb && comp.TotalCumPercent > 0.001f)
{ {
Building_CumBucket bucket = pawn.FindClosestBucket(); Building_CumBucket bucket = pawn.FindClosestBucket();
@ -43,10 +41,6 @@ namespace RJW_Menstruation.Sexperience
__result = JobMaker.MakeJob(VariousDefOf.VaginaWashingwithBucket, null, bucket, bucket.Position); __result = JobMaker.MakeJob(VariousDefOf.VaginaWashingwithBucket, null, bucket, bucket.Position);
} }
} }
} }
} }
} }