rjw_menstruation/1.3/source/RJW_Menstruation/SexperienceModule/JobDrivers.cs
moreoreganostodump c1ac806cb2 1.0.5.4
2021-08-14 00:29:43 +09:00

61 lines
2.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HarmonyLib;
using Verse;
using Verse.AI;
using RimWorld;
using RJWSexperience;
namespace RJW_Menstruation.Sexperience
{
public class JobDriver_VaginaWashingWithBucket : JobDriver
{
const int excretingTime = 300;//ticks - 120 = 2 real seconds, 3 in-game minutes
protected Building_CumBucket Bucket => TargetB.Thing as Building_CumBucket;
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return pawn.Reserve(pawn, job, 1, -1, null, errorOnFailed);
}
protected override IEnumerable<Toil> MakeNewToils()
{
HediffComp_Menstruation Comp = pawn.GetMenstruationComp();
this.FailOn(delegate
{
return !(Comp.TotalCumPercent > 0.001);
});
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 ()
{
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);
}
if (Comp.TotalCumPercent > 0.001) JumpToToil(excreting);
}
};
//yield return excreting;
yield break;
}
}
}