Added JobGiver flirt

Fixed error when loading save, added jobgiver flirt, uses chitchat for now, each interaction slightly reduces sexneed of target
This commit is contained in:
Shabakur 2023-01-16 19:43:32 +01:00
parent 7958f021b9
commit 262bef48c6
9 changed files with 98 additions and 10 deletions

View file

@ -12,7 +12,7 @@ namespace RJW_Genes
{
public class IncidentWorker_SuccubusDreamVisit : IncidentWorker
{
//This incidint will only fire if there is a pawn asleep which while sexneed is lower than 0.25
//This incidint will only fire if there is a pawn asleep and sexneed is lower than 0.25
protected override bool CanFireNowSub(IncidentParms parms)
{
if (!base.CanFireNowSub(parms))
@ -50,7 +50,7 @@ namespace RJW_Genes
return false;
}
//Spawn succubus at pawn and initiate sex
//Spawn succubus at pawn
Pawn succubus = PawnGenerator.GeneratePawn(new PawnGenerationRequest(PawnKindDef.Named("rjw_genes_succubus"), faction, PawnGenerationContext.NonPlayer, -1,
false, false, false, true, false, 1f, false, true, false, true, true, false, false, false, false, 0f, 0f, null, 1f, null, null,
null, null, null, null, null, null, null, null, null, null, false, false, false, false, null, null, null, null, null, 0f,

View file

@ -0,0 +1,56 @@
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);
yield return Toils_General.Wait(600, TargetIndex.A);
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
{
if (this.pawn.interactions.TryInteractWith(this.Target, InteractionDefOf.Chitchat))
{
Need_Sex need_Sex = this.Target.needs.TryGetNeed<Need_Sex>();
need_Sex.CurLevel += -0.01f;
}
});
}
private const TargetIndex TargetInd = TargetIndex.A;
}
}

View file

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
using Verse.AI;
using RimWorld;
namespace RJW_Genes
{
public class JobGiver_Flirt : ThinkNode_JobGiver
{
// Token: 0x0600405A RID: 16474 RVA: 0x0017271C File Offset: 0x0017091C
protected override Job TryGiveJob(Pawn pawn)
{
Pawn target = pawn.mindState.duty.focus.Pawn;
if (pawn.CanReach(target, PathEndMode.InteractionCell, Danger.Deadly))
{
return JobMaker.MakeJob(JobDefOf.rjw_genes_flirt, target);
}
return null;
}
}
}

View file

@ -12,6 +12,10 @@ namespace RJW_Genes
//Based on LordJob_VisitColony
public class LordJob_SuccubusVisit : LordJob
{
public LordJob_SuccubusVisit()
{
}
public LordJob_SuccubusVisit(Pawn target)
{
this.target = target;
@ -78,10 +82,9 @@ namespace RJW_Genes
public override void ExposeData()
{
Scribe_Values.Look<int?>(ref this.durationTicks, "durationTicks", null, false);
Scribe_References.Look<Pawn>(ref this.target, "target", false);
}
public Pawn target;
private int? durationTicks;
public StateGraph exitSubgraph;
}
}