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

Binary file not shown.

View file

@ -56,30 +56,31 @@ namespace Privacy_Please
JobDriver_Sex jobDriver = reactor.jobs.curDriver as JobDriver_Sex;
// Reactors who do not have thoughts applied to them
if (reactor.IsUnableToSenseSex() || reactor.RaceProps.Animal || reactor.RaceProps.IsMechanoid) return ReactionToSexDiscovery.Ignored;
if (reactor.IsUnableToSenseSex()) return ReactionToSexDiscovery.Ignored;
if (reactor.HostileTo(otherPawn)) return ReactionToSexDiscovery.StopSex;
if (reactor.RaceProps.Animal || reactor.RaceProps.IsMechanoid) return ReactionToSexDiscovery.Ignored;
if (otherPawn.RaceProps.Animal || otherPawn.RaceProps.IsMechanoid) return ReactionToSexDiscovery.Uncaring;
if (BasicSettings.slavesIgnoreSex && (reactor.IsPrisoner || reactor.IsSlave)) return ReactionToSexDiscovery.Uncaring;
if (BasicSettings.otherFactionsIgnoreSex && reactor.Faction.IsPlayer == false) return ReactionToSexDiscovery.Uncaring;
if (BasicSettings.copulatorsIgnoreSlaves && (otherPawn.IsPrisoner || otherPawn.IsSlave)) return ReactionToSexDiscovery.Uncaring;
if (BasicSettings.copulatorsIgnoreOtherFactions && otherPawn.Faction.IsPlayer == false) return ReactionToSexDiscovery.Uncaring;
if (BasicSettings.colonistsIgnoreSlaves && (otherPawn.IsPrisoner || otherPawn.IsSlave)) return ReactionToSexDiscovery.Uncaring;
if (BasicSettings.colonistsIgnoreOtherFactions && otherPawn.Faction.IsPlayer == false) return ReactionToSexDiscovery.Uncaring;
// Apply thoughtDef
SexActThoughtDef thoughtDef = GetThoughtDefForReactor(reactor, reaction, out Precept precept);
ReactionToSexDiscovery reactionToSexAct = thoughtDef.reactionToSexDiscovery;
if (applyThoughtDef)
{ reactor.needs.mood.thoughts.memories.TryGainMemory(thoughtDef, otherPawn, precept); }
var nullifyingTraits = ThoughtUtility.GetNullifyingTraits(thoughtDef)?.ToList();
if (thoughtDef.stages[0].baseMoodEffect < 0 && nullifyingTraits?.Any(x => x.HasTrait(reactor)) != true)
if (applyThoughtDef && thoughtDef.stages[0].baseMoodEffect < 0 && nullifyingTraits?.Any(x => x.HasTrait(reactor)) != true)
{ reactor.TryGetComp<CompPawnThoughtData>()?.TryToExclaim(); }
// Reactors who have their reactions changed after applying thoughtDefs
if (BasicSettings.whoringIsUninteruptable && jobDriver?.Sexprops.isWhoring == true) return ReactionToSexDiscovery.Uncaring;
if (BasicSettings.rapeIsUninteruptable && jobDriver?.Sexprops.isRape == true) return ReactionToSexDiscovery.Uncaring;
if (reactor.HostileTo(otherPawn)) return ReactionToSexDiscovery.StopSex;
if (BasicSettings.whoringIsUninteruptable && jobDriver?.Sexprops?.isWhoring == true) return ReactionToSexDiscovery.Uncaring;
if (BasicSettings.rapeIsUninteruptable && jobDriver?.Sexprops?.isRape == true) return ReactionToSexDiscovery.Uncaring;
return reactionToSexAct;
}

View file

@ -96,7 +96,7 @@ namespace Privacy_Please
public static bool IsLoverOfOther(this Pawn pawn, Pawn other)
{
if (pawn == null || other == null)
if (pawn?.relations?.DirectRelations == null || other?.relations?.DirectRelations == null)
{ return false; }
List<DirectPawnRelation> lovers = SpouseRelationUtility.GetLoveRelations(pawn, false);

View file

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using RimWorld;
using Verse;
namespace Privacy_Please
{
public class InteractionWorker_NullWorker : InteractionWorker
{
public InteractionWorker_NullWorker() { }
public override void Interacted(Pawn initiator, Pawn recipient, List<RulePackDef> extraSentencePacks, out string letterText, out string letterLabel, out LetterDef letterDef, out LookTargets lookTargets)
{
base.Interacted(initiator, recipient, extraSentencePacks, out letterText, out letterLabel, out letterDef, out lookTargets);
letterLabel = null;
letterText = null;
letterDef = null;
}
public override float RandomSelectionWeight(Pawn initiator, Pawn recipient)
{
return 0f;
}
}
}

View file

@ -37,9 +37,9 @@ namespace Privacy_Please
};
yield return FollowToil;
Toil SexToil = new Toil();
Toil SexToil = new Toil();
SexToil.defaultCompleteMode = ToilCompleteMode.Never;
SexToil.socialMode = RandomSocialMode.Off;
SexToil.defaultDuration = duration;
SexToil.handlingFacing = true;
SexToil.FailOn(() => (Partner.jobs.curDriver is JobDriver_SexBaseReciever) == false);
SexToil.initAction = delegate

View file

@ -37,7 +37,7 @@ namespace Privacy_Please
WatchToil.AddPreTickAction(delegate
{
if (pawn.IsHashIntervalTick(ticks_between_eyes))
{ ThrowMetaIconF(pawn.Position, pawn.Map, ModFleckDefOf.Eye); }
{ ThrowMetaIconF(pawn.Position, pawn.Map, ModFleckDefOf.EyeHeart); }
if (pawn?.needs?.TryGetNeed<Need_Sex>() != null)
{ pawn.needs.TryGetNeed<Need_Sex>().CurLevel += 0.5f / 2500f; }

View file

@ -25,6 +25,9 @@ namespace Privacy_Please
Quirk cuckold = new Quirk("Cuckold", "CuckoldQuirk");
Quirk.All.AddDistinct(cuckold);
Quirk cuckolder = new Quirk("Cuckolder", "CuckolderQuirk");
Quirk.All.AddDistinct(cuckolder);
DebugMode.Message("Added RJW quirks");
}
}

View file

@ -31,9 +31,11 @@ namespace Privacy_Please
foreach (Thing thing in GenRadial.RadialDistinctThingsAround(pawn.Position, pawn.Map, radius, true))
{
Pawn other = thing as Pawn;
if (other == null) continue;
if (other == null || pawn == other) continue;
DebugMode.Message("Checking " + other.LabelShort);
SexInteractionUtility.GetReactionsToSexDiscovery(pawn.jobs.curDriver as JobDriver_Sex, other, out ReactionToSexDiscovery reactionOfPawn, out ReactionToSexDiscovery reactionOfOther, false);
DebugMode.Message("Reaction: " + reactionOfOther);
// Find candidates to invite
if ((int)reactionOfOther >= (int)ReactionToSexDiscovery.Acceptance && SexInteractionUtility.PasserbyCanBePropositionedForSex(other, pawn.GetAllSexParticipants()))
@ -50,6 +52,7 @@ namespace Privacy_Please
pawn.GetSexInitiator().IsInBed(out Building bed);
DebugMode.Message(invitedPawn.NameShortColored + " was invited to join in sex");
pawn.interactions.TryInteractWith(invitedPawn, ModInteractionDefOf.InviteToHaveGroupSex);
Job job = new Job(DefDatabase<JobDef>.GetNamed("JoinInSex", false), pawn.GetSexPartner(), bed);
invitedPawn.jobs.TryTakeOrderedJob(job);

View file

@ -1,105 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using RimWorld;
using Verse;
using HarmonyLib;
namespace Privacy_Please
{
[HarmonyPatch(typeof(ThoughtWorker_Precept_GroinChestHairOrFaceUncovered), "HasUncoveredGroinChestHairOrFace")]
public static class HarmonyPatch_ThoughtWorker_Precept_GroinChestHairOrFaceUncovered
{
public static void Postfix(ref bool __result, Pawn p)
{
if (__result == false) return;
Pawn pawn = p;
if (BasicSettings.underwearSufficentForIdeos == false) return;
if (pawn?.apparel == null)
{ __result = false; return; }
if (pawn.apparel.WornApparel.NullOrEmpty())
{ __result = true; return; }
bool fullHeadCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.FullHead));
bool groinCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.GenitalsBPG));
bool chestCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.ChestBPG));
bool faceCovered = fullHeadCovered || pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Eyes));
bool hairCovered = fullHeadCovered || pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.UpperHead));
__result = !(groinCovered && chestCovered && faceCovered && hairCovered);
}
}
[HarmonyPatch(typeof(ThoughtWorker_Precept_GroinChestOrHairUncovered), "HasUncoveredGroinChestOrHair")]
public static class HarmonyPatch_ThoughtWorker_Precept_GroinChestOrHairUncovered
{
public static void Postfix(ref bool __result, Pawn p)
{
if (__result == false) return;
Pawn pawn = p;
if (BasicSettings.underwearSufficentForIdeos == false) return;
if (pawn?.apparel == null)
{ __result = false; return; }
if (pawn.apparel.WornApparel.NullOrEmpty())
{ __result = true; return; }
bool fullHeadCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.FullHead));
bool groinCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.GenitalsBPG));
bool chestCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.ChestBPG));
bool hairCovered = fullHeadCovered || pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.UpperHead));
__result = !(groinCovered && chestCovered && hairCovered);
}
}
[HarmonyPatch(typeof(ThoughtWorker_Precept_GroinOrChestUncovered), "HasUncoveredGroinOrChest")]
public static class HarmonyPatch_ThoughtWorker_Precept_HasUncoveredGroinOrChest
{
public static void Postfix(ref bool __result, Pawn p)
{
if (__result == false) return;
Pawn pawn = p;
if (BasicSettings.underwearSufficentForIdeos == false) return;
if (pawn?.apparel == null)
{ __result = false; return; }
if (pawn.apparel.WornApparel.NullOrEmpty())
{ __result = true; return; }
bool groinCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.GenitalsBPG));
bool chestCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.ChestBPG));
__result = !(groinCovered && chestCovered);
}
}
[HarmonyPatch(typeof(ThoughtWorker_Precept_GroinUncovered), "HasUncoveredGroin")]
public static class HarmonyPatch_ThoughtWorker_Precept_GroinUncovered
{
public static void Postfix(ref bool __result, Pawn p)
{
if (__result == false) return;
Pawn pawn = p;
if (BasicSettings.underwearSufficentForIdeos == false) return;
if (pawn?.apparel == null)
{ __result = false; return; }
if (pawn.apparel.WornApparel.NullOrEmpty())
{ __result = true; return; }
bool groinCovered = pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs) || x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.GenitalsBPG));
__result = !groinCovered;
}
}
}

View file

@ -9,55 +9,51 @@ namespace Privacy_Please
{
public class BasicSettings : ModSettings
{
public static bool needPrivacy = true;
public static float chanceForOtherToJoinInSex = 0.25f;
public static bool debugMode = false;
public static bool worryAboutExhibitionism = true;
public static bool worryAboutMasturbation = true;
public static bool worryAboutInfidelity = true;
public static bool worryAboutBeastiality = true;
public static bool worryAboutRape = true;
public static bool worryAboutNecro = true;
public static bool worryAboutXeno = true;
public static bool worryAboutMasturbation = true;
public static bool worryAboutIncest = true;
public static bool majorTabooCanStartFights = false;
public static bool ignoreRitualAndPartySex = true;
public static bool slavesIgnoreSex = false;
public static bool otherFactionsIgnoreSex = false;
public static bool copulatorsIgnoreSlaves = false;
public static bool copulatorsIgnoreOtherFactions = false;
public static bool colonistsIgnoreSlaves = false;
public static bool colonistsIgnoreOtherFactions = false;
public static bool rapeIsUninteruptable = true;
public static bool whoringIsUninteruptable = true;
public static bool rapeIsUninteruptable = false;
public static bool whoringIsUninteruptable = false;
public static bool underwearSufficentForIdeos = true;
public static bool exposedUnderwearMood = true;
public static bool majorTabooCanCausePanic = true;
public static float chanceForOtherToJoinInSex = 0.25f;
public static bool debugMode = false;
public override void ExposeData()
{
base.ExposeData();
Scribe_Values.Look(ref needPrivacy, "needPrivacy", true);
Scribe_Values.Look(ref chanceForOtherToJoinInSex, "chanceForSexExtra", 0.25f);
Scribe_Values.Look(ref debugMode, "debugMode", false);
Scribe_Values.Look(ref worryAboutExhibitionism, "worryAboutExhibitionism", true);
Scribe_Values.Look(ref worryAboutMasturbation, "worryAboutMasturbation", true);
Scribe_Values.Look(ref worryAboutInfidelity, "worryAboutInfidelity", true);
Scribe_Values.Look(ref worryAboutBeastiality, "worryAboutBeastiality", true);
Scribe_Values.Look(ref worryAboutRape, "worryAboutRape", true);
Scribe_Values.Look(ref worryAboutNecro, "worryAboutNecro", true);
Scribe_Values.Look(ref worryAboutXeno, "worryAboutXeno", true);
Scribe_Values.Look(ref worryAboutMasturbation, "worryAboutMasturbation", true);
Scribe_Values.Look(ref worryAboutIncest, "worryAboutIncest", true);
Scribe_Values.Look(ref majorTabooCanStartFights, "majorTabooCanStartFights", false);
Scribe_Values.Look(ref ignoreRitualAndPartySex, "ignoreRitualAndPartySex", false);
Scribe_Values.Look(ref worryAboutXeno, "worryAboutXeno", true);
Scribe_Values.Look(ref ignoreRitualAndPartySex, "ignoreRitualAndPartySex", true);
Scribe_Values.Look(ref slavesIgnoreSex, "slavesIgnoreSex", false);
Scribe_Values.Look(ref otherFactionsIgnoreSex, "otherFactionsIgnoreSex", false);
Scribe_Values.Look(ref copulatorsIgnoreSlaves, "copulatorsIgnoreSlaves", false);
Scribe_Values.Look(ref copulatorsIgnoreOtherFactions, "copulatorsIgnoreOtherFactions", false);
Scribe_Values.Look(ref rapeIsUninteruptable, "slavesIgnoreSex", true);
Scribe_Values.Look(ref whoringIsUninteruptable, "otherFactionsIgnoreSex", true);
Scribe_Values.Look(ref underwearSufficentForIdeos, "underwearSufficentForIdeos", true);
Scribe_Values.Look(ref exposedUnderwearMood, "exposedUnderwearMood", true);
Scribe_Values.Look(ref colonistsIgnoreSlaves, "colonistsIgnoreSlaves", false);
Scribe_Values.Look(ref colonistsIgnoreOtherFactions, "colonistsIgnoreOtherFactions", false);
Scribe_Values.Look(ref rapeIsUninteruptable, "rapeIsUninteruptable", false);
Scribe_Values.Look(ref whoringIsUninteruptable, "whoringIsUninteruptable", false);
Scribe_Values.Look(ref majorTabooCanCausePanic, "majorTabooCanCausePanic", true);
Scribe_Values.Look(ref chanceForOtherToJoinInSex, "chanceForSexExtra", 0.25f);
Scribe_Values.Look(ref debugMode, "debugMode", false);
}
}
@ -101,7 +97,7 @@ namespace Privacy_Please
listingStandard.Label("privacy_please_general".Translate());
listingStandard.Gap(5f);
listingStandard.CheckboxLabeled("need_privacy".Translate(), ref BasicSettings.needPrivacy, "need_privacy_desc".Translate());
listingStandard.CheckboxLabeled("worry_about_exhibitionism".Translate(), ref BasicSettings.worryAboutExhibitionism, "worry_about_exhibitionism_desc".Translate());
listingStandard.CheckboxLabeled("worry_about_masturbation".Translate(), ref BasicSettings.worryAboutMasturbation, "worry_about_masturbation_desc".Translate());
listingStandard.CheckboxLabeled("worry_about_infidelity".Translate(), ref BasicSettings.worryAboutInfidelity, "worry_about_infidelity_desc".Translate());
listingStandard.CheckboxLabeled("worry_about_beastiality".Translate(), ref BasicSettings.worryAboutBeastiality, "worry_about_beastiality_desc".Translate());
@ -114,24 +110,17 @@ namespace Privacy_Please
listingStandard.CheckboxLabeled("ignore_ritual_and_party_sex".Translate(), ref BasicSettings.ignoreRitualAndPartySex, "ignore_ritual_and_party_sex_desc".Translate());
listingStandard.CheckboxLabeled("slaves_ignore_sex".Translate(), ref BasicSettings.slavesIgnoreSex, "slaves_ignore_sex_desc".Translate());
listingStandard.CheckboxLabeled("other_factions_ignore_sex".Translate(), ref BasicSettings.otherFactionsIgnoreSex, "other_factions_ignore_sex_desc".Translate());
listingStandard.CheckboxLabeled("copulators_ignore_slaves".Translate(), ref BasicSettings.copulatorsIgnoreSlaves, "copulators_ignore_slaves_desc".Translate());
listingStandard.CheckboxLabeled("copulators_ignore_other_factions".Translate(), ref BasicSettings.copulatorsIgnoreOtherFactions, "copulators_ignore_other_factions_desc".Translate());
listingStandard.CheckboxLabeled("major_taboo_can_start_fights".Translate(), ref BasicSettings.majorTabooCanStartFights, "major_taboo_can_start_fights_desc".Translate());
listingStandard.CheckboxLabeled("colonists_ignore_slaves".Translate(), ref BasicSettings.colonistsIgnoreSlaves, "colonists_ignore_slaves_desc".Translate());
listingStandard.CheckboxLabeled("colonists_ignore_other_factions".Translate(), ref BasicSettings.colonistsIgnoreOtherFactions, "colonists_ignore_other_factions_desc".Translate());
listingStandard.CheckboxLabeled("major_taboo_can_start_fights".Translate(), ref BasicSettings.majorTabooCanCausePanic, "major_taboo_can_start_fights_desc".Translate());
listingStandard.CheckboxLabeled("rape_is_uninteruptable".Translate(), ref BasicSettings.rapeIsUninteruptable, "rape_is_uninteruptable_desc".Translate());
listingStandard.CheckboxLabeled("whoring_is_uninteruptable".Translate(), ref BasicSettings.whoringIsUninteruptable, "whoring_is_uninteruptable".Translate());
listingStandard.CheckboxLabeled("whoring_is_uninteruptable".Translate(), ref BasicSettings.whoringIsUninteruptable, "whoring_is_uninteruptable_desc".Translate());
listingStandard.Gap(20f);
listingStandard.Label("chance_for_other_to_join_in_sex".Translate() + ": " + BasicSettings.chanceForOtherToJoinInSex.ToString("F"), -1f, "chance_for_other_to_join_in_sex_desc".Translate());
BasicSettings.chanceForOtherToJoinInSex = listingStandard.Slider(BasicSettings.chanceForOtherToJoinInSex, 0f, 1f);
listingStandard.Gap(10f);
listingStandard.Label("privacy_please_clothing".Translate());
listingStandard.Gap(5f);
listingStandard.CheckboxLabeled("underwear_sufficent_for_ideos".Translate(), ref BasicSettings.underwearSufficentForIdeos, "underwear_sufficent_for_ideos_desc".Translate());
listingStandard.CheckboxLabeled("exposed_underwear_mood".Translate(), ref BasicSettings.exposedUnderwearMood, "exposed_underwear_mood_desc".Translate());
listingStandard.Gap(15f);
listingStandard.Label("privacy_please_debugging".Translate());
listingStandard.Gap(5f);

View file

@ -1,38 +0,0 @@
using System;
using RimWorld;
using Verse;
using rjw;
namespace Privacy_Please
{
public class ThoughtWorker_ExposedUnderwear : ThoughtWorker
{
public static ThoughtState CurrentThoughtState(Pawn pawn)
{
if (xxx.has_quirk(pawn, "Exhibitionist") || pawn?.ideo?.Ideo.HasPrecept(ModPreceptDefOf.Exhibitionism_Approved) == true)
{ return ThoughtState.ActiveAtStage(2); }
if (pawn?.ideo?.Ideo.HasPrecept(ModPreceptDefOf.Exhibitionism_Acceptable) == true)
{ return ThoughtState.ActiveAtStage(1); }
return ThoughtState.ActiveAtStage(0);
}
protected override ThoughtState CurrentStateInternal(Pawn pawn)
{
if (BasicSettings.exposedUnderwearMood == false) return false;
if (pawn?.apparel?.WornApparel == null || pawn.apparel.WornApparel.NullOrEmpty()) return false;
if (pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.GenitalsBPG)) &&
pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Legs)) == false)
{ return CurrentThoughtState(pawn); }
if (pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(ModBodyPartGroupDefOf.ChestBPG)) &&
pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(BodyPartGroupDefOf.Torso)) == false)
{ return CurrentThoughtState(pawn); }
return ThoughtState.Inactive;
}
}
}

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

View file

@ -41,13 +41,12 @@
<Compile Include="Scripts\Defs\SexActReactionDef.cs" />
<Compile Include="Scripts\Defs\SexActThoughtDef.cs" />
<Compile Include="Scripts\Extensions\PawnExtension.cs" />
<Compile Include="Scripts\InteractionWorkers\InteractionWorker_NullWorker.cs" />
<Compile Include="Scripts\JobDrivers\JobDriver_WatchSex.cs" />
<Compile Include="Scripts\JobDrivers\JobDriver_JoinInSex.cs" />
<Compile Include="Scripts\Patches\HarmonyPatch_PatchAll.cs" />
<Compile Include="Scripts\Patches\HarmonyPatch_RJW.cs" />
<Compile Include="Scripts\Patches\HarmonyPatch_ThoughtWorkers.cs" />
<Compile Include="Scripts\Settings\BasicSettings.cs" />
<Compile Include="Scripts\ThoughtWorkers\ThoughtWorker_ExposedUnderwear.cs" />
<Compile Include="Scripts\Utilities\DebugMode.cs" />
<Compile Include="Scripts\Utilities\Enums.cs" />
<Compile Include="Scripts\Utilities\ModDefOf.cs" />

Binary file not shown.

Binary file not shown.

View file

@ -1 +1 @@
7168a589dcb8c6bc69e172d8ed7c3d5766de561d
c0e6116b91709008b7d36d54e77d617d264e9150