80 lines
2.2 KiB
C#
80 lines
2.2 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using RimWorld;
|
|||
|
using UnityEngine;
|
|||
|
using Verse;
|
|||
|
using Verse.AI;
|
|||
|
using rjw;
|
|||
|
using Rimworld_Animations;
|
|||
|
|
|||
|
namespace Rimworld_Animations_Patch
|
|||
|
{
|
|||
|
public class JobDriver_JoinInSex : JobDriver_SexBaseInitiator
|
|||
|
{
|
|||
|
public override bool TryMakePreToilReservations(bool errorOnFailed)
|
|||
|
{
|
|||
|
return true; // pawn.Reserve(Target, job, 3, 0, null, errorOnFailed);
|
|||
|
}
|
|||
|
|
|||
|
protected override IEnumerable<Toil> MakeNewToils()
|
|||
|
{
|
|||
|
setup_ticks();
|
|||
|
|
|||
|
this.FailOnDespawnedNullOrForbidden(iTarget);
|
|||
|
this.FailOn(() => !Partner.health.capacities.CanBeAwake);
|
|||
|
this.FailOn(() => pawn.Drafted);
|
|||
|
this.FailOn(() => Partner.Drafted);
|
|||
|
|
|||
|
Toil FollowToil = new Toil();
|
|||
|
FollowToil.defaultCompleteMode = ToilCompleteMode.Delay;
|
|||
|
FollowToil.socialMode = RandomSocialMode.Off;
|
|||
|
FollowToil.defaultDuration = 1200;
|
|||
|
FollowToil.tickAction = delegate
|
|||
|
{
|
|||
|
pawn.pather.StartPath(Partner, PathEndMode.Touch);
|
|||
|
|
|||
|
if (pawn.pather.Moving == false && Partner.pather.Moving == false && Partner.jobs.curDriver is JobDriver_SexBaseReciever)
|
|||
|
{ ReadyForNextToil(); }
|
|||
|
};
|
|||
|
yield return FollowToil;
|
|||
|
|
|||
|
Toil SexToil = new Toil();
|
|||
|
SexToil.defaultCompleteMode = ToilCompleteMode.Never;
|
|||
|
SexToil.socialMode = RandomSocialMode.Off;
|
|||
|
SexToil.defaultDuration = duration;
|
|||
|
SexToil.handlingFacing = true;
|
|||
|
SexToil.FailOn(() => (Partner.jobs.curDriver is JobDriver_SexBaseReciever) == false);
|
|||
|
SexToil.initAction = delegate
|
|||
|
{
|
|||
|
Start();
|
|||
|
Sexprops.usedCondom = CondomUtility.TryUseCondom(pawn) || CondomUtility.TryUseCondom(Partner);
|
|||
|
};
|
|||
|
SexToil.AddPreTickAction(delegate
|
|||
|
{
|
|||
|
if (pawn.IsHashIntervalTick(ticks_between_hearts))
|
|||
|
ThrowMetaIconF(pawn.Position, pawn.Map, FleckDefOf.Heart);
|
|||
|
SexTick(pawn, Partner);
|
|||
|
SexUtility.reduce_rest(pawn, 1);
|
|||
|
if (ticks_left <= 0)
|
|||
|
ReadyForNextToil();
|
|||
|
});
|
|||
|
SexToil.AddFinishAction(delegate
|
|||
|
{
|
|||
|
End();
|
|||
|
});
|
|||
|
yield return SexToil;
|
|||
|
|
|||
|
yield return new Toil
|
|||
|
{
|
|||
|
initAction = delegate
|
|||
|
{
|
|||
|
//// Trying to add some interactions and social logs
|
|||
|
SexUtility.ProcessSex(Sexprops);
|
|||
|
},
|
|||
|
defaultCompleteMode = ToilCompleteMode.Instant
|
|||
|
};
|
|||
|
}
|
|||
|
}
|
|||
|
}
|