rjw_menstruation/1.3/source/RJW_Menstruation/SexperienceModule/JobDrivers.cs

73 lines
2.7 KiB
C#
Raw Normal View History

2022-09-10 13:31:35 +00:00
using RJWSexperienceCum;
2021-08-13 15:29:43 +00:00
using System.Collections.Generic;
using System.Linq;
using Verse;
using Verse.AI;
namespace RJW_Menstruation.Sexperience
{
2021-09-26 09:19:24 +00:00
public class JobDriver_VaginaWashingWithBucket : JobDriver_CleanSelfWithBucket
2021-08-13 15:29:43 +00:00
{
const int excretingTime = 300;//ticks - 120 = 2 real seconds, 3 in-game minutes
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return pawn.Reserve(pawn, job, 1, -1, null, errorOnFailed);
}
protected override IEnumerable<Toil> MakeNewToils()
{
2021-10-16 13:17:39 +00:00
//this.FailOn(delegate
//{
// return !(Comp.TotalCumPercent > 0.001);
//});
2021-08-13 15:29:43 +00:00
yield return Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch);
Toil excreting = Toils_General.Wait(excretingTime, TargetIndex.None);//duration of
excreting.WithProgressBarToilDelay(TargetIndex.A);
yield return excreting;
yield return new Toil()
{
initAction = delegate ()
{
2022-07-11 18:52:27 +00:00
bool anyExcreted = false;
foreach (HediffComp_Menstruation comp in pawn.GetMenstruationComps())
if (comp.TotalCumPercent > 0.001)
2021-10-16 13:17:39 +00:00
{
2022-07-11 18:52:27 +00:00
CumMixture mixture = comp.MixtureOut(RJWSexperience.VariousDefOf.GatheredCum, 0.5f);
float amount = mixture.Volume;
if (mixture.ispurecum)
{
Bucket.AddCum(amount);
}
else
{
GatheredCumMixture cummixture = (GatheredCumMixture)ThingMaker.MakeThing(VariousDefOf.GatheredCumMixture);
cummixture.InitwithCum(mixture);
Bucket.AddCum(amount, cummixture);
}
anyExcreted = true;
2021-10-16 13:17:39 +00:00
}
2022-07-11 18:52:27 +00:00
if (!anyExcreted) ReadyForNextToil();
if (pawn.GetMenstruationComps().Any(c => c.TotalCumPercent > 0.001)) JumpToToil(excreting);
2021-08-13 15:29:43 +00:00
}
};
2021-09-26 09:19:24 +00:00
Toil cleaning = new Toil
{
initAction = CleaningInit,
tickAction = CleaningTick
};
2021-09-26 09:19:24 +00:00
cleaning.AddFinishAction(Finish);
cleaning.defaultCompleteMode = ToilCompleteMode.Never;
cleaning.WithProgressBar(TargetIndex.A, () => progress / CleaningTime);
yield return cleaning;
2021-08-13 15:29:43 +00:00
//yield return excreting;
yield break;
}
}
}