mirror of
https://gitgud.io/AbstractConcept/privacy-please.git
synced 2024-08-15 00:03:18 +00:00
v1.0.0
This commit is contained in:
parent
12b947317e
commit
5224ef08c2
28 changed files with 393 additions and 322 deletions
Binary file not shown.
|
@ -15,6 +15,8 @@ namespace Privacy_Please
|
|||
private Pawn pawn;
|
||||
private int lastExclaimationTick = -1;
|
||||
private int exclaimationCoolDown = 90;
|
||||
private int lastInvitationTick = 600;
|
||||
private int invitationCoolDown = 600;
|
||||
|
||||
public override void Initialize(CompProperties props)
|
||||
{
|
||||
|
@ -50,5 +52,16 @@ namespace Privacy_Please
|
|||
FleckMaker.ThrowMetaIcon(pawn.Position, pawn.Map, FleckDefOf.IncapIcon);
|
||||
}
|
||||
}
|
||||
|
||||
public bool CanSendAnInvitionForSex()
|
||||
{
|
||||
if (Find.TickManager.TicksGame > invitationCoolDown + lastInvitationTick)
|
||||
{
|
||||
lastInvitationTick = Find.TickManager.TicksGame;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,43 +45,41 @@ namespace Privacy_Please
|
|||
public SexActThoughtDef replacementThoughtDef;
|
||||
}
|
||||
|
||||
public void DetermineReactionOfPawns(Pawn pawn, Pawn witness, out ReactionToSexDiscovery reactionOfPawn, out ReactionToSexDiscovery reactionOfWitness, bool applyThoughtDefs = false)
|
||||
public void DetermineReactionOfPawns(Pawn pawn, Pawn witness, out ReactionToSexAct reactionOfPawn, out ReactionToSexAct reactionOfWitness, bool applyThoughtDefs = false)
|
||||
{
|
||||
reactionOfPawn = DetermineReaction(pawn, witness, pawnReaction, applyThoughtDefs);
|
||||
reactionOfWitness = DetermineReaction(witness, pawn, witnessReaction, applyThoughtDefs);
|
||||
}
|
||||
|
||||
public ReactionToSexDiscovery DetermineReaction(Pawn reactor, Pawn otherPawn, SubSexActReactionDef reaction, bool applyThoughtDef)
|
||||
public ReactionToSexAct DetermineReaction(Pawn reactor, Pawn otherPawn, SubSexActReactionDef reaction, bool applyThoughtDef)
|
||||
{
|
||||
JobDriver_Sex jobDriver = reactor.jobs.curDriver as JobDriver_Sex;
|
||||
|
||||
// Reactors who do not have thoughts applied to them
|
||||
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.colonistsIgnoreSlaves && (otherPawn.IsPrisoner || otherPawn.IsSlave)) return ReactionToSexDiscovery.Uncaring;
|
||||
if (BasicSettings.colonistsIgnoreOtherFactions && otherPawn.Faction.IsPlayer == false) return ReactionToSexDiscovery.Uncaring;
|
||||
if (reactor.IsUnableToSenseSex()) return ReactionToSexAct.Ignored;
|
||||
if (reactor.HostileTo(otherPawn)) return ReactionToSexAct.Ignored;
|
||||
if (reactor.RaceProps.Animal || reactor.RaceProps.IsMechanoid) return ReactionToSexAct.Ignored;
|
||||
if (otherPawn.RaceProps.Animal || otherPawn.RaceProps.IsMechanoid) return ReactionToSexAct.Uncaring;
|
||||
if (BasicSettings.slavesIgnoreSex && (reactor.IsPrisoner || reactor.IsSlave)) return ReactionToSexAct.Uncaring;
|
||||
if (BasicSettings.otherFactionsIgnoreSex && reactor.Faction.IsPlayer == false) return ReactionToSexAct.Uncaring;
|
||||
if (BasicSettings.colonistsIgnoreSlaves && (otherPawn.IsPrisoner || otherPawn.IsSlave)) return ReactionToSexAct.Uncaring;
|
||||
if (BasicSettings.colonistsIgnoreOtherFactions && otherPawn.Faction.IsPlayer == false) return ReactionToSexAct.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); }
|
||||
if (thoughtDef == null) return ReactionToSexAct.Uncaring;
|
||||
if (applyThoughtDef) reactor.needs.mood.thoughts.memories.TryGainMemory(thoughtDef, otherPawn, precept);
|
||||
|
||||
var nullifyingTraits = ThoughtUtility.GetNullifyingTraits(thoughtDef)?.ToList();
|
||||
|
||||
if (applyThoughtDef && thoughtDef.stages[0].baseMoodEffect < 0 && nullifyingTraits?.Any(x => x.HasTrait(reactor)) != true)
|
||||
{ reactor.TryGetComp<CompPawnThoughtData>()?.TryToExclaim(); }
|
||||
|
||||
var nullifyingTraits = ThoughtUtility.GetNullifyingTraits(thoughtDef)?.ToList();
|
||||
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 ((otherPawn.jobs.curDriver as JobDriver_Sex)?.Sexprops.isWhoring == true) return ReactionToSexAct.Ignored;
|
||||
if (BasicSettings.whoringIsUninteruptable && jobDriver?.Sexprops?.isWhoring == true) return ReactionToSexAct.Uncaring;
|
||||
if (BasicSettings.rapeIsUninteruptable && jobDriver?.Sexprops?.isRape == true) return ReactionToSexAct.Uncaring;
|
||||
|
||||
return reactionToSexAct;
|
||||
return thoughtDef.reactionToSexDiscovery;
|
||||
}
|
||||
|
||||
private SexActThoughtDef GetThoughtDefForReactor(Pawn reactor, SubSexActReactionDef reaction, out Precept precept)
|
||||
|
|
|
@ -9,6 +9,6 @@ namespace Privacy_Please
|
|||
{
|
||||
public class SexActThoughtDef : ThoughtDef
|
||||
{
|
||||
public ReactionToSexDiscovery reactionToSexDiscovery = ReactionToSexDiscovery.Acceptance;
|
||||
public ReactionToSexAct reactionToSexDiscovery = ReactionToSexAct.Acceptance;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,8 @@ namespace Privacy_Please
|
|||
__instance is JobDriver_SexBaseInitiator &&
|
||||
pawn.GetAllSexParticipants().Count == 2 &&
|
||||
(__instance is JobDriver_JoinInSex) == false &&
|
||||
Random.value < BasicSettings.chanceForOtherToJoinInSex)
|
||||
Random.value < BasicSettings.chanceForOtherToJoinInSex &&
|
||||
pawn.TryGetComp<CompPawnThoughtData>()?.CanSendAnInvitionForSex() == true)
|
||||
{
|
||||
DebugMode.Message("Find another to join in sex?");
|
||||
|
||||
|
@ -33,12 +34,10 @@ namespace Privacy_Please
|
|||
Pawn other = thing as Pawn;
|
||||
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);
|
||||
SexInteractionUtility.GetReactionsToSexAct(pawn.jobs.curDriver as JobDriver_Sex, other, out ReactionToSexAct reactionOfPawn, out ReactionToSexAct reactionOfOther, false);
|
||||
|
||||
// Find candidates to invite
|
||||
if ((int)reactionOfOther >= (int)ReactionToSexDiscovery.Acceptance && SexInteractionUtility.PasserbyCanBePropositionedForSex(other, pawn.GetAllSexParticipants()))
|
||||
if ((int)reactionOfOther >= (int)ReactionToSexAct.Acceptance && SexInteractionUtility.PasserbyCanBePropositionedForSex(other, pawn.GetAllSexParticipants()))
|
||||
{
|
||||
DebugMode.Message(other.NameShortColored + " is a potential candidate");
|
||||
candidates.Add(other);
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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; }
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue