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

Binary file not shown.

View File

@ -14,11 +14,6 @@
<li Class="JobGiver_GetRest"/>
<li Class="JobGiver_SatisfyChemicalNeed"/>
<li Class="JobGiver_SatifyChemicalDependency" MayRequire="Ludeon.RimWorld.Biotech" />
<li Class="ThinkNode_Priority_GetJoy">
<subNodes>
<li Class="JobGiver_GetJoy"/>
</subNodes>
</li>
</subNodes>
</li>
</subNodes>
@ -45,7 +40,7 @@
<!--Flirt with target pawn and try hookup with them, increases sexneed in target pawn, maybe flirt has custom text-->
<li Class="RJW_Genes.JobGiver_Flirt" />
<li Class="JobGiver_WanderNearDutyLocation">
<wanderRadius>5</wanderRadius>

View File

@ -22,4 +22,11 @@
<casualInterruptible>false</casualInterruptible>
<playerInterruptible>false</playerInterruptible>
</JobDef>
<JobDef>
<defName>rjw_genes_flirt</defName>
<driverClass>RJW_Genes.JobDriver_Flirt</driverClass>
<reportString>Seduced.</reportString>
<casualInterruptible>false</casualInterruptible>
</JobDef>
</Defs>

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;
}
}

View File

@ -14,5 +14,6 @@ namespace RJW_Genes
public static readonly JobDef rjw_genes_lifeforce_seduced;
public static readonly JobDef sex_on_spot;
public static readonly JobDef sex_on_spot_reciever;
public static readonly JobDef rjw_genes_flirt;
}
}

View File

@ -130,9 +130,11 @@
<Compile Include="Genes\Life_Force\Gene_LifeForceDrain.cs" />
<Compile Include="Genes\Life_Force\IncidentWorker_SuccubusDreamVisit.cs" />
<Compile Include="Genes\Life_Force\IngestionOutcomeDoer_LifeForceOffset.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_Flirt.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_SexOnSpotReceiver.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_SexOnSpot.cs" />
<Compile Include="Genes\Life_Force\JobDrivers\JobDriver_Seduced.cs" />
<Compile Include="Genes\Life_Force\JobGiver_Flirt.cs" />
<Compile Include="Genes\Life_Force\LordJob_SuccubusVisit.cs" />
<Compile Include="Genes\Life_Force\LordToil_Flirt.cs" />
<Compile Include="Genes\Life_Force\Patch_SexTicks_ChangePsyfocus.cs" />