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()
                {
                    if (Comp.TotalCumPercent > 0.001)
                    {
                        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);
                        }
                    }
                    else
                    {
                        ReadyForNextToil();
                    }
                    if (Comp.TotalCumPercent > 0.001)
                    {
                        JumpToToil(excreting);
                    }
                }
            });

            Toil cleaning = new Toil();

            cleaning.initAction = CleaningInit;
            cleaning.tickAction = CleaningTick;
            cleaning.AddFinishAction(Finish);
            cleaning.defaultCompleteMode = ToilCompleteMode.Never;
            cleaning.WithProgressBar(TargetIndex.A, () => progress / CleaningTime);

            yield return(cleaning);

            //yield return excreting;
            yield break;
        }
Example #2
0
        public override bool TryAbsorbStack(Thing other, bool respectStackLimit)
        {
            float amount = stackCount;
            float count  = ThingUtility.TryAbsorbStackNumToTake(this, other, respectStackLimit);
            bool  res    = base.TryAbsorbStack(other, respectStackLimit);

            if (res && other is GatheredCumMixture)
            {
                GatheredCumMixture othercum = (GatheredCumMixture)other;
                cumColor = Colors.CMYKLerp(cumColor, othercum.cumColor, count / (amount + count));
                if (!othercum.ingredients.NullOrEmpty())
                {
                    for (int i = 0; i < othercum.ingredients.Count; i++)
                    {
                        if (!ingredients.Contains(othercum.ingredients[i]))
                        {
                            ingredients.Add(othercum.ingredients[i]);
                        }
                    }
                }
            }
            return(res);
        }