rjw-genes/Source/Genes/Life_Force/JobDrivers/JobDriver_Seduced.cs
Shabakur 09157e923d sexage check Fertilin and FertilinDraingene
Fertilin and all subgenes are only active if pawn is old enough to have sex, 13 if rjw teensex is enabled else 18.
Added a fertilindraingene which greatly increases fertilin burn, but gives a lot of metabolic efficiency
Also moved a few files into subfolders.
2023-01-09 14:14:51 +01:00

56 lines
1.7 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
using Verse.AI;
using rjw;
using rjw.Modules.Interactions.Enums;
using rjw.Modules.Interactions.Helpers;
using rjw.Modules.Interactions.Objects;
using rjw.Modules.Interactions.Contexts;
using rjw.Modules.Interactions.Implementation;
namespace RJW_Genes
{
public class JobDriver_Seduced : JobDriver
{
//Summary//
//Makes a pawn move to seducing pawn and then tries to rape them.
protected override IEnumerable<Toil> MakeNewToils()
{
this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
this.FailOn(() => !this.pawn.CanReserve(TargetA, xxx.max_rapists_per_prisoner, 0, null, false));
this.FailOn(() => this.pawn.IsFighting());
this.FailOn(() => this.pawn.Drafted);
Pawn partner = this.job.GetTarget(TargetIndex.A).Pawn;
yield return Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch);
yield return new Toil
{
defaultCompleteMode = ToilCompleteMode.Instant,
socialMode = RandomSocialMode.Off,
initAction = delegate ()
{
if(partner != null)
{
partner.drafter.Drafted = false;
this.pawn.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.rjw_genes_seduced, partner, null);
Job newJob = JobMaker.MakeJob(JobDefOf.sex_on_spot, pawn);
partner.jobs.StartJob(newJob, JobCondition.InterruptForced, null, false, true, null, null, false, false, null, false, true);
}
}
};
yield break;
}
public override bool TryMakePreToilReservations(bool errorOnFailed)
{
return this.pawn.Reserve(TargetA, this.job, xxx.max_rapists_per_prisoner, 0, null, errorOnFailed);
}
}
}