mirror of
https://gitgud.io/c0ffeeeeeeee/rjw-events.git
synced 2024-08-14 23:57:42 +00:00
first commit
This commit is contained in:
parent
1c82248286
commit
6d1a218b2e
23 changed files with 836 additions and 0 deletions
102
Source/JobGivers/JobGiver_FindOrgyPartner.cs
Normal file
102
Source/JobGivers/JobGiver_FindOrgyPartner.cs
Normal file
|
@ -0,0 +1,102 @@
|
|||
using RimWorld;
|
||||
using rjw;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
using Verse.AI.Group;
|
||||
|
||||
namespace RJW_Events
|
||||
{
|
||||
|
||||
|
||||
public class JobGiver_FindOrgyPartner : ThinkNode_JobGiver
|
||||
{
|
||||
|
||||
protected override Job TryGiveJob(Pawn pawn)
|
||||
{
|
||||
if (!RJWHookupSettings.HookupsEnabled)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (pawn.Drafted)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Pawn_MindState mindState = pawn.mindState;
|
||||
DutyDef dutyDef;
|
||||
if (mindState == null)
|
||||
{
|
||||
dutyDef = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
PawnDuty duty = mindState.duty;
|
||||
dutyDef = ((duty != null) ? duty.def : null);
|
||||
}
|
||||
if (dutyDef == DutyDefOf.TravelOrLeave)
|
||||
{
|
||||
if (RJWSettings.DebugLogJoinInBed)
|
||||
{
|
||||
ModLog.Message("JoinInBed.TryGiveJob:(" + xxx.get_pawnname(pawn) + "): has TravelOrLeave, no time for lovin!");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!CasualSex_Helper.CanHaveSex(pawn))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
List<Pawn> targets = LordUtility.GetLord(pawn).ownedPawns;
|
||||
|
||||
Pawn pawn2 = null;
|
||||
if(!BestPawnForOrgyExists(pawn, targets, out pawn2))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (pawn2 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (pawn2.jobs.curDriver is JobDriver_SexBaseInitiator)
|
||||
{
|
||||
pawn2 = (Pawn)pawn2.CurJob.targetA;
|
||||
}
|
||||
else if (pawn.CurJob != null && pawn.jobs.curDriver != null)
|
||||
{
|
||||
pawn.jobs.curDriver.EndJobWith(JobCondition.InterruptForced);
|
||||
}
|
||||
return JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("OrgySex", true), pawn2);
|
||||
}
|
||||
|
||||
public bool BestPawnForOrgyExists(Pawn pawn1, List<Pawn> targets, out Pawn result)
|
||||
{
|
||||
if(targets.TryRandomElementByWeight((Pawn p) => {
|
||||
|
||||
float chance = pawn1.relations.SecondaryRomanceChanceFactor(p);
|
||||
if(!(p.jobs.curDriver is JobDriver_Sex))
|
||||
{
|
||||
//higher chance if person is doing nothing
|
||||
chance *= 3f;
|
||||
}
|
||||
return chance;
|
||||
|
||||
}, out Pawn option)) {
|
||||
result = option;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
18
Source/JobGivers/JobGiver_GetNaked.cs
Normal file
18
Source/JobGivers/JobGiver_GetNaked.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
|
||||
namespace RJW_Events
|
||||
{
|
||||
public class JobGiver_GetNaked : ThinkNode_JobGiver
|
||||
{
|
||||
protected override Job TryGiveJob(Pawn pawn)
|
||||
{
|
||||
return JobMaker.MakeJob(DefDatabase<JobDef>.GetNamed("GetNaked", true));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue