This commit is contained in:
AbstractConcept 2023-01-31 00:06:52 -06:00
parent 2256f28cf8
commit 12b947317e
52 changed files with 444 additions and 689 deletions

View file

@ -22,6 +22,20 @@ namespace Privacy_Please
[DefOf]
public static class ModFleckDefOf
{
public static FleckDef Eye;
public static FleckDef EyeHeart;
}
[DefOf]
public static class ModJobDefOf
{
public static JobDef WatchSex;
}
[DefOf]
public static class ModInteractionDefOf
{
public static InteractionDef InviteToHaveSex;
public static InteractionDef InviteToHaveGroupSex;
public static InteractionDef InviteVoyeurism;
}
}

View file

@ -15,14 +15,14 @@ namespace Privacy_Please
{
public static void PrivacyCheckForPawn(Pawn pawn, float radius)
{
if (pawn.IsHavingSex() == false && pawn.IsMasturbating() == false)
{ return; }
if (BasicSettings.ignoreRitualAndPartySex && pawn.IsPartOfRitualOrGathering())
{ return; }
if (pawn.IsHavingSex() == false && pawn.IsMasturbating() == false) return;
if (pawn.IsUnableToSenseSex() || pawn.RaceProps.Animal || pawn.RaceProps.IsMechanoid) return;
if (BasicSettings.ignoreRitualAndPartySex && pawn.IsPartOfRitualOrGathering()) return;
// Local variables
JobDriver_Sex jobDriver = pawn.jobs.curDriver as JobDriver_Sex;
if (jobDriver == null) return;
pawn.IsInBed(out Building bed);
foreach (Thing thing in GenRadial.RadialDistinctThingsAround(pawn.Position, pawn.Map, radius, true))
@ -40,15 +40,19 @@ namespace Privacy_Please
if ((int)reactionOfPawn >= (int)ReactionToSexDiscovery.Acceptance && (int)reactionOfWitness >= (int)ReactionToSexDiscovery.Acceptance && tryToPropositionTheWitness)
{
// Voyeurism
if (pawn.IsVoyeur() || (pawn.IsCuckold() && SexInteractionUtility.SexParticipantsIncludesACheatingPartner(witness, pawn.GetAllSexParticipants())))
if (witness.IsVoyeur() || (witness.IsCuckold() && SexInteractionUtility.SexParticipantsIncludesACheatingPartner(witness, pawn.GetAllSexParticipants())))
{
Job job = new Job(DefDatabase<JobDef>.GetNamed("WatchSex", false), pawn.GetSexReceiver(), bed);
witness.jobs.TryTakeOrderedJob(job);
pawn.interactions.TryInteractWith(witness, ModInteractionDefOf.InviteVoyeurism);
Job job = new Job(ModJobDefOf.WatchSex, pawn);
witness.jobs.TryTakeOrderedJob(job);
}
// Consensual sex
else if (pawn.IsMasturbating())
{
pawn.interactions.TryInteractWith(witness, ModInteractionDefOf.InviteToHaveSex);
if (bed == null)
{
Job job = new Job(xxx.quick_sex, pawn);
@ -65,6 +69,8 @@ namespace Privacy_Please
// Group sex
else
{
pawn.interactions.TryInteractWith(witness, ModInteractionDefOf.InviteToHaveGroupSex);
Job job = new Job(DefDatabase<JobDef>.GetNamed("JoinInSex", false), pawn.GetSexReceiver(), bed);
witness.jobs.TryTakeOrderedJob(job);
}

View file

@ -24,22 +24,21 @@ namespace Privacy_Please
return true;
}
public static bool PawnIsCheatingOnPartner(Pawn pawn, Pawn partner)
public static bool PawnIsCheatingOnPartner(Pawn cheater, Pawn victim)
{
List<Pawn> spouses = pawn.GetSpouses(false);
List<Pawn> spouses = cheater.GetSpouses(false);
if (BasicSettings.worryAboutInfidelity == false ||
partner.IsLoverOfOther(pawn) == false ||
pawn.HasTrait("Polygamous") ||
partner.HasTrait("Polygamous") ||
partner.IsMasturbating() ||
partner.IsHavingSex() == false ||
SexActIsXenophilia(partner.jobs.curDriver as JobDriver_Sex) ||
SexActIsBestiality(partner.jobs.curDriver as JobDriver_Sex) ||
partner.GetAllSexParticipants().Contains(pawn) ||
(spouses.NullOrEmpty() == false && partner.GetAllSexParticipants().Any(x => spouses.Contains(x))))
victim.IsLoverOfOther(cheater) == false ||
cheater.HasTrait("Polygamous") ||
victim.HasTrait("Polygamous") ||
cheater.IsHavingSex() == false ||
SexActIsNecrophilia(cheater.jobs.curDriver as JobDriver_Sex) ||
SexActIsBestiality(cheater.jobs.curDriver as JobDriver_Sex) ||
cheater.GetAllSexParticipants().Contains(victim) ||
(spouses.NullOrEmpty() == false && cheater.GetAllSexParticipants().Any(x => spouses.Contains(x))))
{ return false; }
return true;
}
@ -56,17 +55,20 @@ namespace Privacy_Please
public static bool PasserbyCanBePropositionedForSex(Pawn passerby, List<Pawn> participants)
{
if (passerby == null ||
participants.Contains(passerby) ||
participants.Any(x => x.CanSee(passerby) == false))
{ return false; }
if (passerby == null || participants.Contains(passerby))
{ DebugMode.Message("Cannot proposition " + passerby.NameShortColored + ": they are already involved in the activity"); return false; }
if (participants.Count > 2 ||
participants.Any(x => x.IsForbidden(passerby) ||
x.HostileTo(passerby)) ||
CasualSex_Helper.CanHaveSex(passerby) == false ||
xxx.IsTargetPawnOkay(passerby) == false)
{ return false; }
if (participants.Any(x => x.CanSee(passerby)) == false)
{ DebugMode.Message("Cannot proposition " + passerby.NameShortColored + ": no-one involved can see them"); return false; }
if (participants.Count > 2)
{ DebugMode.Message("Cannot proposition " + passerby.NameShortColored + ": max participants has been reached"); return false; }
if (participants.Any(x => x.IsForbidden(passerby) || x.HostileTo(passerby)))
{ DebugMode.Message("Cannot proposition " + passerby.NameShortColored + ": someone is forbidden or hostile"); return false; }
if (CasualSex_Helper.CanHaveSex(passerby) == false || xxx.IsTargetPawnOkay(passerby) == false)
{ DebugMode.Message("Cannot proposition " + passerby.NameShortColored + ": they cannot have sex"); return false; }
if (SexUtility.ReadyForHookup(passerby) &&
(passerby?.jobs?.curJob == null || (passerby.jobs.curJob.playerForced == false && CasualSex_Helper.quickieAllowedJobs.Contains(passerby.jobs.curJob.def))) &&
@ -74,16 +76,17 @@ namespace Privacy_Please
participants.All(x => SexAppraiser.would_fuck(x, passerby, false, false, true) > 0.1f && SexAppraiser.would_fuck(passerby, x, false, false, true) > 0.1f))
{ return true; }
DebugMode.Message("Cannot proposition " + passerby.NameShortColored + ": they are either too busy or not appealing");
return false;
}
public static void GetReactionsToSexDiscovery(JobDriver_Sex jobDriver, Pawn witness, out ReactionToSexDiscovery reactionOfPawn, out ReactionToSexDiscovery reactionOfWitness, bool applyThoughtDefs = false)
{
Pawn pawn = jobDriver.pawn;
reactionOfPawn = ReactionToSexDiscovery.Acceptance;
reactionOfWitness = ReactionToSexDiscovery.Acceptance;
reactionOfPawn = ReactionToSexDiscovery.Uncaring;
reactionOfWitness = ReactionToSexDiscovery.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)
{
@ -93,16 +96,19 @@ namespace Privacy_Please
{ DebugMode.Message("Method '" + sexActReactionDef.sexActCheck + "' was not found"); continue; }
if ((bool)methodInfo.Invoke(null, new object[] { jobDriver, witness }))
{ sexActReactionDef.DetermineReactionOfPawns(pawn, witness, out reactionOfPawn, out reactionOfWitness, applyThoughtDefs); }
{ sexActReactionDef.DetermineReactionOfPawns(pawn, witness, out reactionOfPawn, out reactionOfWitness, applyThoughtDefs); break; }
}
// Exit here if thoughtDefs are not being applied
if (applyThoughtDefs == false) return;
// 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)
{
Job job = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { pawn }, 24f), pawn);
witness.jobs.ClearQueuedJobs();
witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false);
witness.jobs.StartJob(job);
}
@ -113,6 +119,7 @@ namespace Privacy_Please
Job jobVomit = JobMaker.MakeJob(JobDefOf.Vomit);
Job jobFlee = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { pawn }, 24f), pawn);
witness.jobs.ClearQueuedJobs();
witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false);
if (Random.value <= 0.25f)
@ -128,22 +135,44 @@ namespace Privacy_Please
public static bool SexActIsNecrophilia(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver.Partner != null && jobDriver.Partner.Dead;
return BasicSettings.worryAboutNecro && jobDriver.Partner != null && jobDriver.Partner.Dead;
}
public static bool SexActIsBestiality(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver.Partner != null && jobDriver.Partner.RaceProps.Animal;
return BasicSettings.worryAboutBeastiality && jobDriver.Partner != null && jobDriver.Partner.RaceProps.Animal;
}
public static bool SexActIsBestialityWithOrdinaryAnimal(JobDriver_Sex jobDriver, Pawn witness = null)
{
if (BasicSettings.worryAboutBeastiality == false) return false;
if (jobDriver.Partner == null || jobDriver.Partner.RaceProps.Animal == false) return false;
if (jobDriver.pawn.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_BondOnly") && jobDriver.Partner.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond) != jobDriver.pawn) return true;
if (jobDriver.pawn.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_OnlyVenerated") && jobDriver.pawn.Ideo.IsVeneratedAnimal(jobDriver.Partner) == false) return true;
return false;
}
public static bool SexActIsBestialityWithSpecialAnimal(JobDriver_Sex jobDriver, Pawn witness = null)
{
if (BasicSettings.worryAboutBeastiality == false) return false;
if (jobDriver.Partner == null || jobDriver.Partner.RaceProps.Animal == false) return false;
if (jobDriver.pawn.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_BondOnly") && jobDriver.Partner.relations.GetFirstDirectRelationPawn(PawnRelationDefOf.Bond) == jobDriver.pawn) return true;
if (jobDriver.pawn.Ideo.PreceptsListForReading.Any(x => x.def.defName == "Bestiality_OnlyVenerated") && jobDriver.pawn.Ideo.IsVeneratedAnimal(jobDriver.Partner) == true) return true;
return false;
}
public static bool SexActIsRape(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver is JobDriver_Rape || jobDriver is JobDriver_RapeEnemy || jobDriver is JobDriver_SexBaseRecieverRaped;
return BasicSettings.worryAboutRape && (jobDriver is JobDriver_Rape || jobDriver is JobDriver_RapeEnemy || jobDriver is JobDriver_SexBaseRecieverRaped);
}
public static bool SexActIsXenophilia(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver.Partner != null && jobDriver.Partner.def.defName != jobDriver.pawn.def.defName;
return BasicSettings.worryAboutXeno && jobDriver.Partner != null && jobDriver.Partner.def.defName != jobDriver.pawn.def.defName;
}
public static bool SexActIsMasturbation(JobDriver_Sex jobDriver, Pawn witness = null)
@ -153,12 +182,12 @@ namespace Privacy_Please
public static bool SexActIsExhibitionism(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver.pawn.IsHavingSex();
return BasicSettings.worryAboutExhibitionism && jobDriver.pawn.IsHavingSex();
}
public static bool SexActIsInfidelity(JobDriver_Sex jobDriver, Pawn witness = null)
{
return PawnIsCheatingOnPartner(jobDriver.pawn, witness);
return BasicSettings.worryAboutInfidelity && PawnIsCheatingOnPartner(jobDriver.pawn, witness);
}
}
}