Further updates

This commit is contained in:
AbstractConcept 2023-01-26 00:36:18 -06:00
parent 3eec691bd3
commit 299934584e
25 changed files with 180 additions and 144 deletions

Binary file not shown.

View file

@ -151,22 +151,6 @@ namespace Privacy_Please
return pawn.story.traits.HasTrait(traitDef);
}
public static bool IsUnfazedBySex(this Pawn pawn)
{
if (IsUnableToSenseSex(pawn))
{ return true; }
if (pawn.AnimalOrWildMan() || pawn.RaceProps.IsMechanoid)
{ return true; }
if (BasicSettings.slavesIgnoreSex && (pawn.IsPrisoner || pawn.IsSlave)) return true;
if (BasicSettings.otherFactionsIgnoreSex && pawn.Faction.IsPlayer == false) return true;
if (pawn.Faction.HostileTo(Faction.OfPlayer)) return true;
if (pawn.Drafted == false && pawn.mindState?.duty?.def?.alwaysShowWeapon == true) return true;
return false;
}
public static bool IsUnableToSenseSex(this Pawn pawn)
{
if (pawn.Dead ||

View file

@ -23,7 +23,7 @@ namespace Privacy_Please
(__instance is JobDriver_JoinInSex) == false &&
Random.value < BasicSettings.chanceForOtherToJoinInSex)
{
DebugMode.Message("Find another to join in sex");
DebugMode.Message("Find another to join in sex?");
List<Pawn> candidates = new List<Pawn>();
float radius = 4f;
@ -31,10 +31,12 @@ namespace Privacy_Please
foreach (Thing thing in GenRadial.RadialDistinctThingsAround(pawn.Position, pawn.Map, radius, true))
{
Pawn other = thing as Pawn;
ThoughtDef thoughtDef = null; // SexInteractionUtility.GetThoughtsAboutSexAct(other, __instance, out Precept precept);
if (other == null) continue;
SexInteractionUtility.GetReactionsToSexDiscovery(pawn.jobs.curDriver as JobDriver_Sex, other, out ReactionToSexDiscovery reactionOfPawn, out ReactionToSexDiscovery reactionOfOther, false);
// Find candidates to invite
if (other != null && thoughtDef?.hediff == null && SexInteractionUtility.PasserbyCanBePropositionedForSex(other, pawn.GetAllSexParticipants()))
if ((int)reactionOfOther >= (int)ReactionToSexDiscovery.Acceptance && SexInteractionUtility.PasserbyCanBePropositionedForSex(other, pawn.GetAllSexParticipants()))
{
DebugMode.Message(other.NameShortColored + " is a potential candidate");
candidates.Add(other);
@ -59,7 +61,7 @@ namespace Privacy_Please
[HarmonyPatch(typeof(JobDriver_Sex), "SexTick")]
public static class HarmonyPatch_JobDriver_Sex_SexTick
{
// If pawns don't have privacy, they'll stop having sex
// When pawns are having sex, intermittently check their surrounds for privacy
public static void Postfix(ref JobDriver_Sex __instance, Pawn pawn)
{
if (pawn.IsHashIntervalTick(90))

View file

@ -25,6 +25,7 @@ namespace Privacy_Please
public static bool ignoreRitualAndPartySex = true;
public static bool slavesIgnoreSex = false;
public static bool otherFactionsIgnoreSex = false;
public static bool rapeIsUninteruptable = true;
public static bool whoringIsUninteruptable = true;
public static bool underwearSufficentForIdeos = true;
@ -48,8 +49,10 @@ namespace Privacy_Please
Scribe_Values.Look(ref ignoreRitualAndPartySex, "ignoreRitualAndPartySex", false);
Scribe_Values.Look(ref slavesIgnoreSex, "slavesIgnoreSex", false);
Scribe_Values.Look(ref otherFactionsIgnoreSex, "otherFactionsIgnoreSex", 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 underwearSufficentForIdeos, "exposedUnderwearMood", true);
Scribe_Values.Look(ref exposedUnderwearMood, "exposedUnderwearMood", true);
}
}
@ -107,7 +110,9 @@ namespace Privacy_Please
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("major_taboo_can_start_fights".Translate(), ref BasicSettings.majorTabooCanStartFights, "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.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());

View file

@ -5,9 +5,7 @@
Approval = 1,
Acceptance = 0,
Discomfort = -1,
Outrage = -2,
Panick = -3,
Nauseated = -3,
Random = -99,
Panic = -2,
Nausea = -3,
}
}

View file

@ -12,20 +12,6 @@ namespace Privacy_Please
public static BodyPartGroupDef ChestBPG;
}
/*[DefOf]
public static class ModThoughtDefOf
{
public static ThoughtDef SeenHavingSex;
public static ThoughtDef SeenHavingSexExhibitionist;
public static ThoughtDef SeenMasturbating;
public static ThoughtDef SeenMasturbatingExhibitionist;
public static ThoughtDef SawSex;
public static ThoughtDef SawSexVoyeur;
public static ThoughtDef SawMasturbation;
public static ThoughtDef SawMasturbationVoyeur;
public static ThoughtDef CaughtCheating;
}*/
[DefOf]
public static class ModPreceptDefOf
{

View file

@ -30,7 +30,6 @@ namespace Privacy_Please
Pawn witness = thing as Pawn;
if (witness == null) continue;
// Caught having sex
if (SexInteractionUtility.PawnCaughtLovinByWitness(pawn, witness))
{
// Get the pawn's and witness' reaction to the discovery
@ -63,20 +62,17 @@ namespace Privacy_Please
}
}
// Threesome
else if (pawn.GetSexReceiver() != null)
// Group sex
else
{
Job job = new Job(DefDatabase<JobDef>.GetNamed("JoinInSex", false), pawn.GetSexReceiver(), bed);
witness.jobs.TryTakeOrderedJob(job);
}
}
// The proposition failed. Awwkkkwaaarrddd....
else if (pawn.IsUnfazedBySex() == false && (int)reactionOfPawn < (int)ReactionToSexDiscovery.Approval)
{
if (BasicSettings.whoringIsUninteruptable && jobDriver?.Sexprops.isWhoring == true)
{ return; }
// The proposition failed. Is this awkward for those having sex?
else if (SexInteractionUtility.PawnWorriesAboutSexWitness(pawn, witness) && (int)reactionOfPawn < (int)ReactionToSexDiscovery.Approval)
{
// The pawn is uncomfortable and is stopping sex
foreach (Pawn participant in pawn.GetAllSexParticipants())
{ participant.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false); }

View file

@ -14,18 +14,35 @@ namespace Privacy_Please
{
public static bool PawnCaughtLovinByWitness(Pawn pawn, Pawn witness)
{
if (witness == null || pawn == witness || witness.IsUnableToSenseSex() || witness.CanSee(pawn) == false)
{ return false; }
if (witness == null || pawn == witness || witness.IsUnableToSenseSex() || witness.CanSee(pawn) == false) return false;
List<Pawn> sexParticipants = pawn.GetAllSexParticipants();
bool witnessIsJoiningSex = witness.jobs.curDriver is JobDriver_SexBaseInitiator && sexParticipants.Contains((witness.jobs.curDriver as JobDriver_SexBaseInitiator).Partner);
if (sexParticipants.Contains(witness) || witnessIsJoiningSex)
{ return false; }
if (sexParticipants.Contains(witness) || witnessIsJoiningSex) return false;
return true;
}
public static bool PawnWorriesAboutSexWitness(Pawn pawn, Pawn witness)
{
JobDriver_Sex jobDriver = pawn.jobs.curDriver as JobDriver_Sex;
if (pawn.IsUnableToSenseSex() || pawn.AnimalOrWildMan() || pawn.RaceProps.IsMechanoid || pawn.Faction.HostileTo(Faction.OfPlayer)) return false;
if (BasicSettings.rapeIsUninteruptable && jobDriver?.Sexprops.isRape == true) return true;
if (witness.HostileTo(pawn)) return true;
if (witness.RaceProps.Animal || witness.RaceProps.IsMechanoid) return false;
if (pawn.Drafted == true || pawn.mindState?.duty?.def?.alwaysShowWeapon == true) return false;
if (BasicSettings.slavesIgnoreSex && (pawn.IsPrisoner || pawn.IsSlave || witness.IsPrisoner || witness.IsSlave)) return false;
if (BasicSettings.otherFactionsIgnoreSex && (pawn.Faction.IsPlayer == false || witness.Faction.IsPlayer == false)) return false;
if (BasicSettings.whoringIsUninteruptable && jobDriver?.Sexprops.isWhoring == true) return true;
return true;
}
public static bool PawnIsCheatingOnPartner(Pawn pawn, Pawn partner)
{
List<Pawn> spouses = pawn.GetSpouses(false);
@ -36,8 +53,8 @@ namespace Privacy_Please
partner.HasTrait("Polygamous") ||
partner.IsMasturbating() ||
partner.IsHavingSex() == false ||
partner.GetSexPartner()?.Dead == true ||
partner.GetSexPartner()?.IsAnimal() == true ||
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))))
{ return false; }
@ -94,10 +111,36 @@ namespace Privacy_Please
{ DebugMode.Message("Method '" + sexActReactionDef.sexActCheck + "' was not found"); continue; }
if ((bool)methodInfo.Invoke(null, new object[] { jobDriver }))
{ sexActReactionDef.DetermineReactionOfPawns(pawn, witness, out reactionOfPawn, out reactionOfWitness, applyThoughtDefs); }
}
// Exit here if thoughtDefs are not being applied
if (applyThoughtDefs == false) return;
// Panic reaction
if (reactionOfWitness == ReactionToSexDiscovery.Panic)
{
Job job = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { pawn }, 24f), pawn);
witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false);
witness.jobs.StartJob(job);
}
// Vomit reaction
else if (reactionOfWitness == ReactionToSexDiscovery.Nausea)
{
Job jobVomit = JobMaker.MakeJob(JobDefOf.Vomit);
Job jobFlee = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { pawn }, 24f), pawn);
witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false);
if (Random.value <= 0.25f)
{
DebugMode.Message(sexActReactionDef.defName);
sexActReactionDef.DetermineReactionOfPawns(pawn, witness, out reactionOfPawn, out reactionOfWitness, applyThoughtDefs);
witness.jobs.StartJob(jobVomit);
witness.jobs.jobQueue.EnqueueFirst(jobFlee);
}
else
{ witness.jobs.StartJob(jobFlee); }
}
}

Binary file not shown.

Binary file not shown.