Updates and bug fixes

This commit is contained in:
AbstractConcept 2023-01-29 10:54:14 -06:00
parent 299934584e
commit 2256f28cf8
15 changed files with 74 additions and 64 deletions

View file

@ -3,9 +3,12 @@
public enum ReactionToSexDiscovery
{
Approval = 1,
Acceptance = 0,
Discomfort = -1,
Panic = -2,
Nausea = -3,
Uncaring = 0,
Acceptance = -1,
Discomfort = -2,
Panic = -3,
Nausea = -4,
Ignored = -99,
StopSex = -100,
}
}

View file

@ -34,7 +34,7 @@ namespace Privacy_Please
{
// 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 && SexInteractionUtility.PasserbyCanBePropositionedForSex(witness, pawn.GetAllSexParticipants());
bool tryToPropositionTheWitness = Random.value < BasicSettings.chanceForOtherToJoinInSex && jobDriver?.Sexprops.isWhoring != true && SexInteractionUtility.PasserbyCanBePropositionedForSex(witness, pawn.GetAllSexParticipants());
// Try to proposition the witness
if ((int)reactionOfPawn >= (int)ReactionToSexDiscovery.Acceptance && (int)reactionOfWitness >= (int)ReactionToSexDiscovery.Acceptance && tryToPropositionTheWitness)
@ -71,11 +71,16 @@ namespace Privacy_Please
}
// The proposition failed. Is this awkward for those having sex?
else if (SexInteractionUtility.PawnWorriesAboutSexWitness(pawn, witness) && (int)reactionOfPawn < (int)ReactionToSexDiscovery.Approval)
else if ((int)reactionOfPawn < (int)ReactionToSexDiscovery.Uncaring)
{
// The pawn is uncomfortable and is stopping sex
foreach (Pawn participant in pawn.GetAllSexParticipants())
{ participant.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false); }
{
JobDriver_Sex participantJobDriver = participant.jobs.curDriver as JobDriver_Sex;
if (participantJobDriver?.ticks_left > 60)
{ participantJobDriver.ticks_left = 60; }
}
}
}
}

View file

@ -17,32 +17,13 @@ namespace Privacy_Please
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);
bool witnessIsJoiningSex = witness.jobs.curDriver is JobDriver_SexBaseInitiator && sexParticipants.Contains((witness.jobs.curDriver as JobDriver_SexBaseInitiator).Target);
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);
@ -75,13 +56,14 @@ namespace Privacy_Please
public static bool PasserbyCanBePropositionedForSex(Pawn passerby, List<Pawn> participants)
{
if (passerby == null ||
if (passerby == null ||
participants.Contains(passerby) ||
participants.Any(x => x.CanSee(passerby) == false))
{ return false; }
if (participants.Count > 2 ||
participants.Any(x => x.IsForbidden(passerby) || x.HostileTo(passerby)) ||
participants.Any(x => x.IsForbidden(passerby) ||
x.HostileTo(passerby)) ||
CasualSex_Helper.CanHaveSex(passerby) == false ||
xxx.IsTargetPawnOkay(passerby) == false)
{ return false; }
@ -102,7 +84,7 @@ namespace Privacy_Please
reactionOfPawn = ReactionToSexDiscovery.Acceptance;
reactionOfWitness = ReactionToSexDiscovery.Acceptance;
// Determine if there are any issues with the sex event and the witness' morals
// 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)
{
var methodInfo = AccessTools.Method(typeof(SexInteractionUtility), sexActReactionDef.sexActCheck, null, null);
@ -110,7 +92,7 @@ namespace Privacy_Please
if (methodInfo == null)
{ DebugMode.Message("Method '" + sexActReactionDef.sexActCheck + "' was not found"); continue; }
if ((bool)methodInfo.Invoke(null, new object[] { jobDriver }))
if ((bool)methodInfo.Invoke(null, new object[] { jobDriver, witness }))
{ sexActReactionDef.DetermineReactionOfPawns(pawn, witness, out reactionOfPawn, out reactionOfWitness, applyThoughtDefs); }
}
@ -144,39 +126,39 @@ namespace Privacy_Please
}
}
public static bool SexActIsNecrophilia(JobDriver_Sex jobDriver)
public static bool SexActIsNecrophilia(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver.Partner != null && jobDriver.Partner.Dead;
}
public static bool SexActIsBestiality(JobDriver_Sex jobDriver)
public static bool SexActIsBestiality(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver.Partner != null && jobDriver.Partner.RaceProps.Animal;
}
public static bool SexActIsRape(JobDriver_Sex jobDriver)
public static bool SexActIsRape(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver is JobDriver_Rape || jobDriver is JobDriver_RapeEnemy || jobDriver is JobDriver_SexBaseRecieverRaped;
}
public static bool SexActIsXenophilia(JobDriver_Sex jobDriver)
public static bool SexActIsXenophilia(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver.Partner != null && jobDriver.Partner.def.defName != jobDriver.pawn.def.defName;
}
public static bool SexActIsMasturbation(JobDriver_Sex jobDriver)
public static bool SexActIsMasturbation(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver.pawn.IsMasturbating();
}
public static bool SexActIsExhibitionism(JobDriver_Sex jobDriver)
public static bool SexActIsExhibitionism(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver.pawn.IsHavingSex();
}
public static bool SexActIsInfidelity(JobDriver_Sex jobDriver)
public static bool SexActIsInfidelity(JobDriver_Sex jobDriver, Pawn witness = null)
{
return jobDriver.pawn.IsHavingSex();
return PawnIsCheatingOnPartner(jobDriver.pawn, witness);
}
}
}