This commit is contained in:
AbstractConcept 2023-02-01 16:05:06 -06:00
parent 12b947317e
commit 5224ef08c2
28 changed files with 393 additions and 322 deletions

View file

@ -1,6 +1,6 @@
namespace Privacy_Please
{
public enum ReactionToSexDiscovery
public enum ReactionToSexAct
{
Approval = 1,
Uncaring = 0,
@ -9,6 +9,6 @@
Panic = -3,
Nausea = -4,
Ignored = -99,
StopSex = -100,
Invalid = -100,
}
}

View file

@ -37,5 +37,12 @@ namespace Privacy_Please
public static InteractionDef InviteToHaveSex;
public static InteractionDef InviteToHaveGroupSex;
public static InteractionDef InviteVoyeurism;
public static InteractionDef InterruptedSex;
}
[DefOf]
public static class ModSexActReactionDefOf
{
public static SexActReactionDef reactionToExhibitionism;
}
}

View file

@ -33,11 +33,14 @@ namespace Privacy_Please
if (SexInteractionUtility.PawnCaughtLovinByWitness(pawn, witness))
{
// 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 && jobDriver?.Sexprops.isWhoring != true && SexInteractionUtility.PasserbyCanBePropositionedForSex(witness, pawn.GetAllSexParticipants());
SexInteractionUtility.GetReactionsToSexAct(jobDriver, witness, out ReactionToSexAct reactionOfPawn, out ReactionToSexAct reactionOfWitness, true);
bool tryToPropositionTheWitness = Random.value < BasicSettings.chanceForOtherToJoinInSex &&
SexInteractionUtility.PasserbyCanBePropositionedForSex(witness, pawn.GetAllSexParticipants()) &&
pawn.TryGetComp<CompPawnThoughtData>()?.CanSendAnInvitionForSex() == true;
// Try to proposition the witness
if ((int)reactionOfPawn >= (int)ReactionToSexDiscovery.Acceptance && (int)reactionOfWitness >= (int)ReactionToSexDiscovery.Acceptance && tryToPropositionTheWitness)
if ((int)reactionOfPawn >= (int)ReactionToSexAct.Acceptance && (int)reactionOfWitness >= (int)ReactionToSexAct.Acceptance && tryToPropositionTheWitness)
{
// Voyeurism
if (witness.IsVoyeur() || (witness.IsCuckold() && SexInteractionUtility.SexParticipantsIncludesACheatingPartner(witness, pawn.GetAllSexParticipants())))
@ -77,13 +80,15 @@ namespace Privacy_Please
}
// The proposition failed. Is this awkward for those having sex?
else if ((int)reactionOfPawn < (int)ReactionToSexDiscovery.Uncaring)
else if ((int)reactionOfPawn < (int)ReactionToSexAct.Uncaring)
{
Find.PlayLog.Add(new PlayLogEntry_Interaction(ModInteractionDefOf.InterruptedSex, witness, pawn, new List<RulePackDef>()));
// The pawn is uncomfortable and is stopping sex
foreach (Pawn participant in pawn.GetAllSexParticipants())
{
JobDriver_Sex participantJobDriver = participant.jobs.curDriver as JobDriver_Sex;
JobDriver_Sex participantJobDriver = participant.jobs.curDriver as JobDriver_Sex;
if (participantJobDriver?.ticks_left > 60)
{ participantJobDriver.ticks_left = 60; }
}

View file

@ -80,12 +80,12 @@ namespace Privacy_Please
return false;
}
public static void GetReactionsToSexDiscovery(JobDriver_Sex jobDriver, Pawn witness, out ReactionToSexDiscovery reactionOfPawn, out ReactionToSexDiscovery reactionOfWitness, bool applyThoughtDefs = false)
public static void GetReactionsToSexAct(JobDriver_Sex jobDriver, Pawn witness, out ReactionToSexAct reactionOfPawn, out ReactionToSexAct reactionOfWitness, bool applyThoughtDefs = false)
{
Pawn pawn = jobDriver.pawn;
reactionOfPawn = ReactionToSexDiscovery.Uncaring;
reactionOfWitness = ReactionToSexDiscovery.Uncaring;
reactionOfPawn = ReactionToSexAct.Uncaring;
reactionOfWitness = ReactionToSexAct.Uncaring;
// Determine if there are any issues with the sex event and the witness' morals and apply thoughtDefs as required
foreach (SexActReactionDef sexActReactionDef in DefDatabase<SexActReactionDef>.AllDefs)
@ -98,13 +98,16 @@ namespace Privacy_Please
if ((bool)methodInfo.Invoke(null, new object[] { jobDriver, witness }))
{ sexActReactionDef.DetermineReactionOfPawns(pawn, witness, out reactionOfPawn, out reactionOfWitness, applyThoughtDefs); break; }
}
DebugMode.Message("Reaction of " + pawn.NameShortColored + " to " + witness.NameShortColored + "'s presence: " + reactionOfPawn.ToString());
DebugMode.Message("Reaction of " + witness.NameShortColored + " to " + pawn.NameShortColored + "'s activities: " + reactionOfWitness.ToString());
// Exit here if thoughtDefs are not being applied
if (applyThoughtDefs == false || BasicSettings.majorTabooCanCausePanic == false) return;
if (witness?.Drafted == true || witness?.mindState?.duty?.def.alwaysShowWeapon == true) return;
// Panic reaction
if (reactionOfWitness == ReactionToSexDiscovery.Panic)
if (reactionOfWitness == ReactionToSexAct.Panic)
{
Job job = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { pawn }, 24f), pawn);
@ -114,7 +117,7 @@ namespace Privacy_Please
}
// Vomit reaction
else if (reactionOfWitness == ReactionToSexDiscovery.Nausea)
else if (reactionOfWitness == ReactionToSexAct.Nausea)
{
Job jobVomit = JobMaker.MakeJob(JobDefOf.Vomit);
Job jobFlee = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { pawn }, 24f), pawn);
@ -175,14 +178,9 @@ namespace Privacy_Please
return BasicSettings.worryAboutXeno && jobDriver.Partner != null && jobDriver.Partner.def.defName != jobDriver.pawn.def.defName;
}
public static bool SexActIsMasturbation(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver.pawn.IsMasturbating();
}
public static bool SexActIsExhibitionism(JobDriver_Sex jobDriver, Pawn witness = null)
{
return BasicSettings.worryAboutExhibitionism && jobDriver.pawn.IsHavingSex();
return BasicSettings.worryAboutExhibitionism && (jobDriver.pawn.IsMasturbating() || jobDriver.pawn.IsHavingSex());
}
public static bool SexActIsInfidelity(JobDriver_Sex jobDriver, Pawn witness = null)