2023-01-16 18:43:32 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Verse;
|
|
|
|
|
using Verse.AI;
|
|
|
|
|
using RimWorld;
|
|
|
|
|
using rjw;
|
|
|
|
|
namespace RJW_Genes
|
|
|
|
|
{
|
|
|
|
|
public class JobDriver_Flirt : JobDriver
|
|
|
|
|
{
|
|
|
|
|
private Pawn Target
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (Pawn)((Thing)this.pawn.CurJob.GetTarget(TargetIndex.A));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public override bool TryMakePreToilReservations(bool errorOnFailed)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Some wait toils to induce delay
|
|
|
|
|
protected override IEnumerable<Toil> MakeNewToils()
|
|
|
|
|
{
|
|
|
|
|
this.FailOnDespawnedOrNull(TargetIndex.A);
|
|
|
|
|
yield return Toils_Interpersonal.GotoInteractablePosition(TargetIndex.A);
|
2023-01-17 11:35:01 +00:00
|
|
|
|
yield return Toils_General.Wait(300, TargetIndex.A);
|
2023-01-16 18:43:32 +00:00
|
|
|
|
yield return Toils_Interpersonal.WaitToBeAbleToInteract(this.pawn);
|
|
|
|
|
Toil toil = Toils_Interpersonal.GotoInteractablePosition(TargetIndex.A);
|
|
|
|
|
toil.socialMode = RandomSocialMode.Off;
|
|
|
|
|
yield return toil;
|
|
|
|
|
yield return this.InteractToil();
|
|
|
|
|
Toil toil1 = Toils_General.Wait(600, TargetIndex.A);
|
|
|
|
|
toil1.socialMode = RandomSocialMode.Off;
|
|
|
|
|
yield break;
|
|
|
|
|
}
|
|
|
|
|
private Toil InteractToil()
|
|
|
|
|
{
|
|
|
|
|
return Toils_General.Do(delegate
|
|
|
|
|
{
|
2023-01-17 11:58:23 +00:00
|
|
|
|
if (this.pawn.interactions.TryInteractWith(this.Target, ThoughtDefOf.rjw_genes_flirt))
|
2023-01-16 18:43:32 +00:00
|
|
|
|
{
|
|
|
|
|
Need_Sex need_Sex = this.Target.needs.TryGetNeed<Need_Sex>();
|
|
|
|
|
need_Sex.CurLevel += -0.01f;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private const TargetIndex TargetInd = TargetIndex.A;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|