2022-11-06 04:14:02 +00:00
|
|
|
|
using System.Collections.Generic;
|
2022-11-04 13:52:17 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2022-11-06 04:14:02 +00:00
|
|
|
|
using UnityEngine;
|
2022-11-04 13:52:17 +00:00
|
|
|
|
using RimWorld;
|
|
|
|
|
using Verse;
|
|
|
|
|
using Verse.AI;
|
|
|
|
|
using Verse.AI.Group;
|
|
|
|
|
using rjw;
|
|
|
|
|
|
|
|
|
|
namespace Privacy_Please
|
|
|
|
|
{
|
|
|
|
|
public static class PrivacyUtility
|
|
|
|
|
{
|
2022-11-06 04:14:02 +00:00
|
|
|
|
public static void PrivacyCheckForPawn(Pawn pawn, float radius)
|
2022-11-04 13:52:17 +00:00
|
|
|
|
{
|
|
|
|
|
if (pawn.IsHavingSex() == false && pawn.IsMasturbating() == false)
|
2022-11-06 04:14:02 +00:00
|
|
|
|
{ return; }
|
2022-11-04 13:52:17 +00:00
|
|
|
|
|
2022-11-06 04:14:02 +00:00
|
|
|
|
if (BasicSettings.ignoreRitualAndPartySex && pawn.IsPartOfRitualOrGathering())
|
|
|
|
|
{ return; }
|
2022-11-04 13:52:17 +00:00
|
|
|
|
|
2022-11-06 04:14:02 +00:00
|
|
|
|
// Local variables
|
|
|
|
|
JobDriver_Sex jobDriver = pawn.jobs.curDriver as JobDriver_Sex;
|
2022-11-04 13:52:17 +00:00
|
|
|
|
pawn.IsInBed(out Building bed);
|
|
|
|
|
|
|
|
|
|
foreach (Thing thing in GenRadial.RadialDistinctThingsAround(pawn.Position, pawn.Map, radius, true))
|
|
|
|
|
{
|
|
|
|
|
Pawn witness = thing as Pawn;
|
|
|
|
|
if (witness == null) continue;
|
|
|
|
|
|
|
|
|
|
if (SexInteractionUtility.PawnCaughtLovinByWitness(pawn, witness))
|
|
|
|
|
{
|
2022-11-06 04:14:02 +00:00
|
|
|
|
// Get the pawn's and witness' reaction to the discovery
|
|
|
|
|
SexInteractionUtility.GetReactionsToSexDiscovery(jobDriver, witness, out ReactionToSexDiscovery reactionOfPawn, out ReactionToSexDiscovery reactionOfWitness, true);
|
|
|
|
|
bool tryToPropositionTheWitness = Random.value < BasicSettings.chanceForOtherToJoinInSex && SexInteractionUtility.PasserbyCanBePropositionedForSex(witness, pawn.GetAllSexParticipants());
|
2022-11-06 04:04:23 +00:00
|
|
|
|
|
2022-11-06 04:14:02 +00:00
|
|
|
|
// Try to proposition the witness
|
|
|
|
|
if ((int)reactionOfPawn >= (int)ReactionToSexDiscovery.Acceptance && (int)reactionOfWitness >= (int)ReactionToSexDiscovery.Acceptance && tryToPropositionTheWitness)
|
|
|
|
|
{
|
|
|
|
|
// Voyeurism
|
|
|
|
|
if (pawn.IsVoyeur() || (pawn.IsCuckold() && SexInteractionUtility.SexParticipantsIncludesACheatingPartner(witness, pawn.GetAllSexParticipants())))
|
2022-11-04 13:52:17 +00:00
|
|
|
|
{
|
|
|
|
|
Job job = new Job(DefDatabase<JobDef>.GetNamed("WatchSex", false), pawn.GetSexReceiver(), bed);
|
|
|
|
|
witness.jobs.TryTakeOrderedJob(job);
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-06 04:14:02 +00:00
|
|
|
|
// Consensual sex
|
2022-11-04 13:52:17 +00:00
|
|
|
|
else if (pawn.IsMasturbating())
|
|
|
|
|
{
|
|
|
|
|
if (bed == null)
|
|
|
|
|
{
|
|
|
|
|
Job job = new Job(xxx.quick_sex, pawn);
|
|
|
|
|
witness.jobs.TryTakeOrderedJob(job);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Job job = new Job(xxx.casual_sex, pawn, bed);
|
|
|
|
|
witness.jobs.TryTakeOrderedJob(job);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-26 06:36:18 +00:00
|
|
|
|
// Group sex
|
|
|
|
|
else
|
2022-11-04 13:52:17 +00:00
|
|
|
|
{
|
|
|
|
|
Job job = new Job(DefDatabase<JobDef>.GetNamed("JoinInSex", false), pawn.GetSexReceiver(), bed);
|
|
|
|
|
witness.jobs.TryTakeOrderedJob(job);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-26 06:36:18 +00:00
|
|
|
|
// The proposition failed. Is this awkward for those having sex?
|
|
|
|
|
else if (SexInteractionUtility.PawnWorriesAboutSexWitness(pawn, witness) && (int)reactionOfPawn < (int)ReactionToSexDiscovery.Approval)
|
|
|
|
|
{
|
2022-11-06 04:14:02 +00:00
|
|
|
|
// The pawn is uncomfortable and is stopping sex
|
|
|
|
|
foreach (Pawn participant in pawn.GetAllSexParticipants())
|
|
|
|
|
{ participant.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false); }
|
|
|
|
|
}
|
2022-11-04 13:52:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|