mirror of
https://gitgud.io/AbstractConcept/rimworld-animations-patch.git
synced 2024-08-15 00:43:27 +00:00
v 2.0.0
This commit is contained in:
parent
fcf187c7dd
commit
38ec4f86c1
68 changed files with 846 additions and 1934 deletions
|
@ -60,7 +60,7 @@ namespace Rimworld_Animations_Patch
|
|||
if (orgasmTick > ticks)
|
||||
{
|
||||
// Safeguard for penial, vaginal and anal sex
|
||||
if (anim.actors[actorId].isFucked || anim.actors[actorId].isFucking || (anim.actors[actorId].requiredGenitals.NullOrEmpty() == false && anim.actors[actorId].requiredGenitals.Any(x => x.ToLower().ContainsAny("penis", "vagina", "anus"))))
|
||||
if (anim.actors[actorId].isFucked || anim.actors[actorId].isFucking || (anim.actors[actorId].requiredGenitals.NullOrEmpty() == false && anim.actors[actorId].requiredGenitals.Any(x => x.ContainsAny("penis", "vagina", "anus", "Penis", "Vagina", "Anus"))))
|
||||
{ orgasmTick = Mathf.Clamp(ticks - 5, 0, int.MaxValue); }
|
||||
|
||||
// Actor does not orgasm
|
||||
|
@ -187,16 +187,17 @@ namespace Rimworld_Animations_Patch
|
|||
{
|
||||
{ "Alien_Orassan", new Vector3(1.4f, 1.4f, 1.4f) },
|
||||
{ "Alien_Cutebold", new Vector3(1.2f, 1f, 1f) },
|
||||
{ "Rabbie", new Vector3(-0.5f, 1f, 1f) },
|
||||
};
|
||||
|
||||
public static Vector2 GetRaceSpecificOffsetMultipliers(Pawn pawn, string bodypart)
|
||||
public static Vector2 GetRaceSpecificOffsetMultipliers(Pawn pawn, BodyPartDef bodypart)
|
||||
{
|
||||
Vector2 multiplierVector = new Vector2();
|
||||
|
||||
if (GetBodySize(pawn) == 1f || raceSpecifocChildMultipliers.TryGetValue(pawn.def.defName, out Vector3 raceVector) == false)
|
||||
{ raceVector = new Vector3(1f, 1f, 1f); }
|
||||
|
||||
if (bodypart?.ToLower() == "tail")
|
||||
if (bodypart?.defName == "tail" || bodypart?.defName == "Tail")
|
||||
{
|
||||
multiplierVector.x = raceVector.z;
|
||||
multiplierVector.y = raceVector.x;
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace Rimworld_Animations_Patch
|
|||
{ bodyPartCovered = bodyPartCovered || PrivatePartCoveredByApparel(apparel, "Chest"); }
|
||||
|
||||
if (requiredGenitals.Contains("Mouth"))
|
||||
{ bodyPartCovered = bodyPartCovered || apparel.def.apparel.CoversBodyPart(bodyParts.FirstOrDefault(x => x.def.defName.ToLower().ContainsAny("mouth", "teeth", "jaw", "beak"))); }
|
||||
{ bodyPartCovered = bodyPartCovered || apparel.def.apparel.CoversBodyPart(bodyParts.FirstOrDefault(x => x.def.defName.ContainsAny("mouth", "teeth", "jaw", "beak", "Mouth", "Teeth", "Jaw", "Beak"))); }
|
||||
|
||||
return bodyPartCovered;
|
||||
}
|
||||
|
|
|
@ -13,27 +13,21 @@ namespace Rimworld_Animations_Patch
|
|||
{
|
||||
public static BodyPartDef handDef;
|
||||
|
||||
public static bool BodyPartIsBeingTouched(Pawn pawn, string bodypartFilePath, out List<HandAnimationData> handAnimationData)
|
||||
public static bool BodyPartIsBeingTouched(Pawn pawn, ActorAnimationData actorAnimationData, string bodypartFilePath, out List<HandAnimationData> handAnimationData)
|
||||
{
|
||||
handAnimationData = new List<HandAnimationData>();
|
||||
HandAnimationDef handAnimationDef = pawn?.TryGetComp<CompPawnSexData>()?.handAnimationDef;
|
||||
ActorAnimationData actorAnimationData = pawn?.GetAnimationData();
|
||||
|
||||
if (handAnimationDef == null || actorAnimationData == null || bodypartFilePath.NullOrEmpty())
|
||||
{ return false; }
|
||||
|
||||
foreach (HandAnimationData datum in handAnimationDef.handAnimationData)
|
||||
{
|
||||
if (datum.stageID != actorAnimationData.currentStage || datum.actorID != actorAnimationData.actorID)
|
||||
{ continue; }
|
||||
if (datum.stageID != actorAnimationData.currentStage || datum.actorID != actorAnimationData.actorID) continue;
|
||||
if (datum.bodySide.NullOrEmpty() == false && bodypartFilePath.Contains(datum.bodySide, StringComparison.OrdinalIgnoreCase) == false) continue;
|
||||
|
||||
if (datum.bodySide.NullOrEmpty() == false && bodypartFilePath.ToLower().Contains(datum.bodySide) == false)
|
||||
{ continue; }
|
||||
|
||||
if (datum.targetBodyPart.NullOrEmpty() == false && bodypartFilePath.ToLower().Contains(datum.targetBodyPart.ToLower()))
|
||||
{ handAnimationData.Add(datum); }
|
||||
|
||||
else if (datum.targetBodyParts.Any(x => bodypartFilePath.ToLower().Contains(x.ToLower())))
|
||||
if ((datum.targetBodyPart.NullOrEmpty() == false && bodypartFilePath.Contains(datum.targetBodyPart, StringComparison.OrdinalIgnoreCase)) ||
|
||||
datum.targetBodyParts.Any(x => bodypartFilePath.Contains(x, StringComparison.OrdinalIgnoreCase)))
|
||||
{ handAnimationData.Add(datum); }
|
||||
}
|
||||
|
||||
|
@ -42,147 +36,26 @@ namespace Rimworld_Animations_Patch
|
|||
|
||||
public static Vector3 GetHandPosition(Pawn pawn, HandAnimationData handAnimationData, Vector3 basePosition, float baseAngle)
|
||||
{
|
||||
var methodInfo = AccessTools.Method(typeof(HandAnimationUtility), handAnimationData.motion, null, null);
|
||||
|
||||
if (methodInfo == null)
|
||||
{
|
||||
Debug.LogWarning("Hand animation motion '" + handAnimationData.motion + "' was not found");
|
||||
return default;
|
||||
}
|
||||
|
||||
Vector3 handPosition = (Vector3)methodInfo.Invoke(null, new object[] { pawn, handAnimationData, baseAngle });
|
||||
|
||||
Vector3 handPosition = handAnimationData.Motion.GetHandPosition(pawn, handAnimationData, baseAngle);
|
||||
return handPosition * pawn.RaceProps.baseBodySize + basePosition + new Vector3(0f, 0.3f, 0f);
|
||||
}
|
||||
|
||||
public static float GetGenitalSize(Pawn pawn, string genitalName)
|
||||
{
|
||||
switch(genitalName.ToLower())
|
||||
CompPawnSexData data = pawn?.TryGetComp<CompPawnSexData>();
|
||||
if (data == null) return 0f;
|
||||
|
||||
switch (genitalName)
|
||||
{
|
||||
case "penis": return pawn.health.hediffSet.hediffs.First(x => x.def.defName.ToLower().Contains("penis")).Severity;
|
||||
case "breasts": return pawn.health.hediffSet.hediffs.First(x => x.def.defName.ToLower().Contains("breasts")).Severity;
|
||||
case "vagina": return 0.1f;
|
||||
case "anus": return 0.1f;
|
||||
case "penis": return data.sizeOfPenis;
|
||||
case "breasts": return data.sizeOfBreasts;
|
||||
case "Penis": return data.sizeOfPenis;
|
||||
case "Breasts": return data.sizeOfBreasts;
|
||||
}
|
||||
|
||||
return 0.1f;
|
||||
}
|
||||
|
||||
public static Vector3 Motion_StrokeGenitalsUpAndDownShort_FacingNS(Pawn pawn, HandAnimationData handAnimationData, float baseAngle)
|
||||
{
|
||||
Vector3 handPosition = new Vector3();
|
||||
ActorAnimationData data = pawn.GetAnimationData();
|
||||
|
||||
float p = (Mathf.PingPong(data.stageTicks, handAnimationData.cycleTime) / handAnimationData.cycleTime);
|
||||
float length = 0.035f;
|
||||
|
||||
handPosition.x = 0;
|
||||
handPosition.z = length * p;
|
||||
|
||||
handPosition = handPosition.RotatedBy(baseAngle);
|
||||
|
||||
return handPosition;
|
||||
}
|
||||
|
||||
public static Vector3 Motion_StrokeGenitalsUpAndDown_FacingNS(Pawn pawn, HandAnimationData handAnimationData, float baseAngle)
|
||||
{
|
||||
Vector3 handPosition = new Vector3();
|
||||
ActorAnimationData data = pawn.GetAnimationData();
|
||||
|
||||
float p = (Mathf.PingPong(data.stageTicks, handAnimationData.cycleTime) / handAnimationData.cycleTime);
|
||||
float size = GetGenitalSize(pawn, handAnimationData.targetBodyPart) * 0.2f;
|
||||
float m = (data.actorFacing == Rot4.North ? -1f : 1f) * (handAnimationData.mirror ? -1f : 1f) * (pawn.TryGetComp<CompBodyAnimator>().Mirror ? -1f : 1f);
|
||||
|
||||
handPosition.x = 0.025f * m;
|
||||
handPosition.z = size * p;
|
||||
|
||||
handPosition = handPosition.RotatedBy(baseAngle);
|
||||
|
||||
return handPosition;
|
||||
}
|
||||
|
||||
public static Vector3 Motion_StrokeGenitalsUpAndDown_FacingEW(Pawn pawn, HandAnimationData handAnimationData, float baseAngle)
|
||||
{
|
||||
Vector3 handPosition = new Vector3();
|
||||
ActorAnimationData data = pawn.GetAnimationData();
|
||||
|
||||
float p = Mathf.PingPong(data.stageTicks, handAnimationData.cycleTime) / handAnimationData.cycleTime;
|
||||
float size = GetGenitalSize(pawn, handAnimationData.targetBodyPart) * 0.2f;
|
||||
float m = (data.actorFacing == Rot4.West ? -1f : 1f) * (handAnimationData.mirror ? -1f : 1f);
|
||||
|
||||
handPosition.x = Mathf.Sin(m * (baseAngle + 45f) / 180f * Mathf.PI) * size * p;
|
||||
handPosition.z = Mathf.Cos(m * (baseAngle + 45f) / 180f * Mathf.PI) * size * p;
|
||||
|
||||
return handPosition;
|
||||
}
|
||||
|
||||
public static Vector3 Motion_RubGenitals_FacingNS(Pawn pawn, HandAnimationData handAnimationData, float baseAngle)
|
||||
{
|
||||
Vector3 handPosition = new Vector3();
|
||||
ActorAnimationData data = pawn.GetAnimationData();
|
||||
|
||||
float a = ((float)data.stageTicks % (float)handAnimationData.cycleTime) / (float)handAnimationData.cycleTime * 360f;
|
||||
float m = (data.actorFacing == Rot4.North ? 1f : -1f) * (handAnimationData.mirror ? -1f : 1f) * (pawn.TryGetComp<CompBodyAnimator>().Mirror ? -1f : 1f);
|
||||
|
||||
handPosition.x = (Mathf.Sin(a / 180f * Mathf.PI) * 0.05f - 0.025f) * m;
|
||||
handPosition.z = Mathf.Cos(a / 180f * Mathf.PI) * 0.015f + 0.03f;
|
||||
|
||||
handPosition = handPosition.RotatedBy(baseAngle);
|
||||
|
||||
return handPosition;
|
||||
}
|
||||
|
||||
public static Vector3 Motion_RubGenitals_FacingEW(Pawn pawn, HandAnimationData handAnimationData, float baseAngle)
|
||||
{
|
||||
Vector3 handPosition = new Vector3();
|
||||
ActorAnimationData data = pawn.GetAnimationData();
|
||||
|
||||
float a = ((float)data.stageTicks % (float)handAnimationData.cycleTime) / (float)handAnimationData.cycleTime * 360f;
|
||||
float m = (data.actorFacing == Rot4.West ? 1f : -1f) * (handAnimationData.mirror ? -1f : 1f);
|
||||
|
||||
handPosition.x = (Mathf.Sin(a / 180f * Mathf.PI) * 0.005f - 0.05f) * m;
|
||||
handPosition.z = Mathf.Cos(a / 180f * Mathf.PI) * 0.015f;
|
||||
//handPosition.y = -0.1f;
|
||||
|
||||
handPosition = handPosition.RotatedBy(baseAngle);
|
||||
|
||||
return handPosition;
|
||||
}
|
||||
|
||||
public static Vector3 Motion_RubBreasts_FacingNS(Pawn pawn, HandAnimationData handAnimationData, float baseAngle)
|
||||
{
|
||||
Vector3 handPosition = new Vector3();
|
||||
ActorAnimationData data = pawn.GetAnimationData();
|
||||
|
||||
float a = ((float)data.stageTicks % (float)handAnimationData.cycleTime) / (float)handAnimationData.cycleTime * 360f;
|
||||
float m = (data.actorFacing == Rot4.North ? -1f : 1f) * (handAnimationData.mirror ? -1f : 1f) * (pawn.TryGetComp<CompBodyAnimator>().Mirror ? -1f : 1f);
|
||||
float size = GetGenitalSize(pawn, "breasts");
|
||||
|
||||
handPosition.x = (Mathf.Sin(a / 180f * Mathf.PI) * 0.05f * size - size * 0.25f) * m;
|
||||
handPosition.z = Mathf.Cos(a / 180f * Mathf.PI) * 0.015f - size * 0.125f;
|
||||
|
||||
handPosition = handPosition.RotatedBy(baseAngle);
|
||||
|
||||
return handPosition;
|
||||
}
|
||||
|
||||
public static Vector3 Motion_RubBreasts_FacingEW(Pawn pawn, HandAnimationData handAnimationData, float baseAngle)
|
||||
{
|
||||
Vector3 handPosition = new Vector3();
|
||||
ActorAnimationData data = pawn.GetAnimationData();
|
||||
|
||||
float a = ((float)data.stageTicks % (float)handAnimationData.cycleTime) / (float)handAnimationData.cycleTime * 360f;
|
||||
float m = (data.actorFacing == Rot4.West ? 1f : -1f) * (handAnimationData.mirror ? -1f : 1f);
|
||||
float size = GetGenitalSize(pawn, "breasts");
|
||||
|
||||
handPosition.x = (Mathf.Sin(a / 180f * Mathf.PI) * 0.005f - size * 0.25f) * m;
|
||||
handPosition.z = Mathf.Cos(a / 180f * Mathf.PI) * 0.015f - size * 0.125f;
|
||||
|
||||
handPosition = handPosition.RotatedBy(baseAngle);
|
||||
|
||||
return handPosition;
|
||||
}
|
||||
|
||||
public static Graphic GetHandGraphic(Pawn touchingPawn)
|
||||
{
|
||||
CompPawnSexData comp = touchingPawn?.TryGetComp<CompPawnSexData>();
|
||||
|
@ -198,9 +71,9 @@ namespace Rimworld_Animations_Patch
|
|||
return comp.handGraphic;
|
||||
}
|
||||
|
||||
public static bool TryToDrawHand(Pawn pawn, string bodyAddonName, Vector3 bodyAddonPosition, float bodyAddonAngle, Rot4 bodyAddonRotation, PawnRenderFlags renderFlags)
|
||||
public static bool TryToDrawHand(Pawn pawn, ActorAnimationData pawnAnimationData, string bodyAddonName, Vector3 bodyAddonPosition, float bodyAddonAngle, Rot4 bodyAddonRotation, PawnRenderFlags renderFlags)
|
||||
{
|
||||
if (BodyPartIsBeingTouched(pawn, bodyAddonName, out List<HandAnimationData> handAnimationData))
|
||||
if (BodyPartIsBeingTouched(pawn, pawnAnimationData, bodyAddonName, out List<HandAnimationData> handAnimationData))
|
||||
{
|
||||
foreach (HandAnimationData datum in handAnimationData)
|
||||
{
|
||||
|
|
|
@ -33,14 +33,19 @@ namespace Rimworld_Animations_Patch
|
|||
{
|
||||
for (int radius = 1; radius < maxRadius; radius++)
|
||||
{
|
||||
List<IntVec3> cells = GenRadial.RadialCellsAround(pawn.Position, radius + 0.75f, false).Where(x => x.Standable(pawn.Map) && x.GetRoom(pawn.Map) == pawn.GetRoom())?.ToList();
|
||||
IEnumerable<IntVec3> cells = GenRadial.RadialCellsAround(pawn.Position, radius + 0.75f, false).Where(x => x.Standable(pawn.Map) && x.GetRoom(pawn.Map) == pawn.GetRoom());
|
||||
|
||||
if (cells.NullOrEmpty() == false && cells.Count > 0)
|
||||
if (cells.Any() == true && cells.Count() > 0)
|
||||
{ return cells.RandomElement(); }
|
||||
}
|
||||
}
|
||||
|
||||
return GenAdj.RandomAdjacentCellCardinal(pawn);
|
||||
}
|
||||
|
||||
public static float ClampAngle(float angle)
|
||||
{
|
||||
return angle < 0f ? 360f - (angle % 360) : angle % 360f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,5 +16,8 @@ namespace Rimworld_Animations_Patch
|
|||
public static class PatchBodyPartDefOf
|
||||
{
|
||||
public static BodyPartDef Hand;
|
||||
public static BodyPartDef Genitals;
|
||||
public static BodyPartDef Anus;
|
||||
public static BodyPartDef Chest;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,266 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
using Verse.AI;
|
||||
using Verse.AI.Group;
|
||||
using RimWorld;
|
||||
using rjw;
|
||||
using RJWSexperience.Ideology;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Rimworld_Animations_Patch
|
||||
{
|
||||
public static class SexInteractionUtility
|
||||
{
|
||||
public static bool PawnCaughtLovinByWitness(Pawn pawn, Pawn witness)
|
||||
{
|
||||
if (witness == null || pawn == witness || witness.AnimalOrWildMan() || witness.RaceProps.IsMechanoid || witness.Awake() == false || witness.CanSee(pawn) == false)
|
||||
{ return false; }
|
||||
|
||||
if (pawn.IsHavingSex() == false && pawn.IsMasturbating() == false)
|
||||
{ return false; }
|
||||
|
||||
List<Pawn> sexParticipants = pawn.GetAllSexParticipants();
|
||||
bool witnessIsCourtingSexParticipant = witness.jobs.curDriver is JobDriver_SexBaseInitiator && sexParticipants.Contains((witness.jobs.curDriver as JobDriver_SexBaseInitiator).Partner);
|
||||
|
||||
if (sexParticipants.Contains(witness) || witnessIsCourtingSexParticipant)
|
||||
{ return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool PawnIsCheatingOnPartner(Pawn pawn, Pawn partner)
|
||||
{
|
||||
if (BasicSettings.worryAboutInfidelity == false || pawn.IsMasturbating() || pawn.IsHavingSex() == false || pawn.GetAllSexParticipants().Contains(partner))
|
||||
{ return false; }
|
||||
|
||||
if (pawn.GetAllSexParticipants().Any(x => pawn.GetSpouseCount(false) > 0 && pawn.GetSpouses(false).Contains(x)))
|
||||
{ return false; }
|
||||
|
||||
if (pawn.GetSexPartner().Dead || pawn.GetSexPartner().IsAnimal())
|
||||
{ return false; }
|
||||
|
||||
return partner.IsLoverOfOther(pawn) && pawn.HasTrait("Polygamist") == false && partner.HasTrait("Polygamist") == false;
|
||||
}
|
||||
|
||||
public static bool InvitePasserbyForSex(Pawn passerby, List<Pawn> participants)
|
||||
{
|
||||
if (passerby == null || participants.NullOrEmpty() || participants.Contains(passerby) || passerby.AnimalOrWildMan() || passerby.RaceProps.IsMechanoid || passerby.Awake() == false || participants.All(x => x.CanSee(passerby) == false))
|
||||
{ return false; }
|
||||
|
||||
if (participants.Any(x => x.IsForbidden(passerby) || x.HostileTo(passerby) || PawnIsCheatingOnPartner(x, passerby)) || CasualSex_Helper.CanHaveSex(passerby) == false || xxx.IsTargetPawnOkay(passerby) == false || participants.Count > 2)
|
||||
{ return false; }
|
||||
|
||||
if (passerby.MentalState != null ||
|
||||
passerby.jobs.curDriver is JobDriver_Flee ||
|
||||
passerby.jobs.curDriver is JobDriver_AttackMelee ||
|
||||
passerby.jobs.curDriver is JobDriver_Vomit)
|
||||
{ return false; }
|
||||
|
||||
if (SexUtility.ReadyForHookup(passerby) &&
|
||||
(passerby?.jobs?.curJob == null || (passerby.jobs.curJob.playerForced == false && CasualSex_Helper.quickieAllowedJobs.Contains(passerby.jobs.curJob.def))) &&
|
||||
participants.Any(x => SexAppraiser.would_fuck(x, passerby) > 0.1f && SexAppraiser.would_fuck(passerby, x) > 0.1f) &&
|
||||
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;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static ThoughtDef GetThoughtsAboutSexAct(Pawn pawn, JobDriver_Sex jobDriver, out Precept precept)
|
||||
{
|
||||
ThoughtDef thoughtDef = null;
|
||||
precept = null;
|
||||
|
||||
if (pawn == null || jobDriver == null)
|
||||
{ return null; }
|
||||
|
||||
bool sexIsNecro = jobDriver.Partner != null && jobDriver.Partner.Dead;
|
||||
bool sexIsBeastial = jobDriver.Partner != null && jobDriver.Partner.RaceProps.Animal;
|
||||
bool sexIsRape = sexIsBeastial == false && sexIsNecro == false &&
|
||||
(jobDriver is JobDriver_Rape || jobDriver is JobDriver_RapeEnemy || jobDriver is JobDriver_SexBaseRecieverRaped);
|
||||
bool sexIsSlaveRape = sexIsRape && (jobDriver.Partner.IsPrisoner || jobDriver.Partner.IsSlave);
|
||||
bool sexIsXeno = jobDriver.Partner != null && jobDriver.Partner.def.defName != jobDriver.pawn.def.defName;
|
||||
bool isXenophobe = pawn.HasTrait("Xenophobia") && pawn.story.traits.DegreeOfTrait(DefDatabase<TraitDef>.GetNamedSilentFail("Xenophobia")) > 0;
|
||||
bool isXenophile = pawn.HasTrait("Xenophobia") && pawn.story.traits.DegreeOfTrait(DefDatabase<TraitDef>.GetNamedSilentFail("Xenophobia")) < 0;
|
||||
|
||||
if (BasicSettings.worryAboutNecro && sexIsNecro && xxx.is_necrophiliac(pawn) == false)
|
||||
{
|
||||
thoughtDef = xxx.is_necrophiliac(pawn) ? DefDatabase<ThoughtDef>.GetNamedSilentFail("SawNecrophilia_Honorable") :
|
||||
pawn.HasPreceptForIssue("Necrophilia", out precept) ? DefDatabase<ThoughtDef>.GetNamedSilentFail("Saw" + precept.def.defName) :
|
||||
DefDatabase<ThoughtDef>.GetNamedSilentFail("SawNecrophilia_Abhorrent");
|
||||
}
|
||||
|
||||
else if (BasicSettings.worryAboutBeastiality && sexIsBeastial)
|
||||
{
|
||||
thoughtDef = xxx.is_zoophile(pawn) ? DefDatabase<ThoughtDef>.GetNamedSilentFail("SawBeastility_Honorable") :
|
||||
pawn.HasPreceptForIssue("Beastility", out precept) ? DefDatabase<ThoughtDef>.GetNamedSilentFail("Saw" + precept.def.defName) :
|
||||
DefDatabase<ThoughtDef>.GetNamedSilentFail("SawBeastility_Abhorrent");
|
||||
}
|
||||
|
||||
else if (BasicSettings.worryAboutRape && BasicSettings.ignoreSlaveRape == false && sexIsSlaveRape)
|
||||
{
|
||||
thoughtDef = xxx.is_rapist(pawn) ? DefDatabase<ThoughtDef>.GetNamedSilentFail("SawRape_Honorable") :
|
||||
pawn.HasPreceptForIssue("Rape", out precept) ? DefDatabase<ThoughtDef>.GetNamedSilentFail("Saw" + precept.def.defName) :
|
||||
DefDatabase<ThoughtDef>.GetNamedSilentFail("SawRape_Abhorrent");
|
||||
}
|
||||
|
||||
else if (BasicSettings.worryAboutRape && sexIsRape)
|
||||
{
|
||||
thoughtDef = xxx.is_rapist(pawn) ? DefDatabase<ThoughtDef>.GetNamedSilentFail("SawRape_Honorable") :
|
||||
pawn.HasPreceptForIssue("Rape", out precept) ? DefDatabase<ThoughtDef>.GetNamedSilentFail("Saw" + precept.def.defName) :
|
||||
DefDatabase<ThoughtDef>.GetNamedSilentFail("SawRape_Abhorrent");
|
||||
}
|
||||
|
||||
else if (BasicSettings.worryAboutXeno && sexIsXeno)
|
||||
{
|
||||
thoughtDef = isXenophobe ? DefDatabase<ThoughtDef>.GetNamedSilentFail("SawHAR_AlienDating_Prohibited") :
|
||||
isXenophile ? DefDatabase<ThoughtDef>.GetNamedSilentFail("SawHAR_AlienDating_Honorable") :
|
||||
pawn.HasPreceptForIssue("HAR_AlienDating", out precept) ? DefDatabase<ThoughtDef>.GetNamedSilentFail("Saw" + precept.def.defName) :
|
||||
DefDatabase<ThoughtDef>.GetNamedSilentFail("SawHAR_AlienDating_Acceptable");
|
||||
}
|
||||
|
||||
//DebugMode.Message("Sex job is: " + jobDriver + " Issue is: " + (precept?.def?.issue?.defName).ToStringSafe() + " Opinion is: " + (precept?.def?.defName).ToStringSafe() + " Thought is: " + (thoughtDef?.defName).ToStringSafe());
|
||||
|
||||
return thoughtDef;
|
||||
}
|
||||
|
||||
public static void TriggerReactionInWitness(Pawn witness, Pawn otherPawn, string reaction)
|
||||
{
|
||||
if (BasicSettings.majorTabooCanStartFights == false || reaction.NullOrEmpty())
|
||||
{ return; }
|
||||
|
||||
if (witness.MentalState != null ||
|
||||
witness.jobs.curDriver is JobDriver_Flee ||
|
||||
witness.jobs.curDriver is JobDriver_AttackMelee ||
|
||||
witness.jobs.curDriver is JobDriver_Vomit)
|
||||
{ return; }
|
||||
|
||||
// Panicked
|
||||
if (reaction == "Panicked" || (reaction == "Indignant" && Random.value <= 0.5f))
|
||||
{
|
||||
// Fight
|
||||
if (otherPawn.RaceProps.Humanlike && witness.RaceProps.Humanlike && witness.DislikesViolence() == false && (Random.value <= 0.2f || witness.EnjoysViolence()) && witness.HostileTo(otherPawn) == false && InteractionUtility.TryGetRandomVerbForSocialFight(witness, out Verb verbToUse))
|
||||
{ witness.interactions.StartSocialFight(otherPawn, "MessageSocialFight"); }
|
||||
|
||||
// Flight
|
||||
else
|
||||
{
|
||||
Job job = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { otherPawn }, 24f), otherPawn);
|
||||
witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false);
|
||||
witness.jobs.StartJob(job);
|
||||
}
|
||||
}
|
||||
|
||||
// Vomit
|
||||
else if (reaction == "Nauseated")
|
||||
{
|
||||
Job jobVomit = JobMaker.MakeJob(JobDefOf.Vomit);
|
||||
Job jobFlee = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List<Thing>() { otherPawn }, 24f), otherPawn);
|
||||
|
||||
witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false);
|
||||
|
||||
if (Random.value <= 0.2f)
|
||||
{
|
||||
witness.jobs.StartJob(jobVomit);
|
||||
witness.jobs.jobQueue.EnqueueFirst(jobFlee);
|
||||
}
|
||||
|
||||
else
|
||||
{ witness.jobs.StartJob(jobFlee); }
|
||||
}
|
||||
|
||||
// Indignant
|
||||
else if (reaction == "Indignant")
|
||||
{
|
||||
witness.mindState.mentalStateHandler.TryStartMentalState(DefDatabase<MentalStateDef>.GetNamedSilentFail("TargetedInsultingSpree"), null, true, false, null, true, false, false);
|
||||
(witness.mindState.mentalStateHandler.CurState as MentalState_TargetedInsultingSpree).target = otherPawn;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool ResolveThoughtsForWhenSexIsWitnessed(Pawn pawn, Pawn witness, out bool witnessJoiningSex)
|
||||
{
|
||||
witnessJoiningSex = Random.value < BasicSettings.chanceForOtherToJoinInSex && InvitePasserbyForSex(witness, pawn.GetAllSexParticipants());
|
||||
|
||||
// Exit clauses
|
||||
if (witness.AnimalOrWildMan() || witness.RaceProps.IsMechanoid || witness.Dead || witness.Faction == null || witness.Faction.HostileTo(Faction.OfPlayer))
|
||||
{ return false; }
|
||||
|
||||
// Get basic thoughts
|
||||
string pawnThoughtDefName = pawn.IsMasturbating() ? "SeenMasturbating" : "SeenHavingSex";
|
||||
string witnessThoughtDefName = pawn.IsMasturbating() ? "SawMasturbation" : "SawSex";
|
||||
|
||||
ThoughtDef pawnThoughtDef = BasicSettings.needPrivacy ? DefDatabase<ThoughtDef>.GetNamedSilentFail(pawnThoughtDefName) : null;
|
||||
ThoughtDef witnessThoughtDef = BasicSettings.needPrivacy ? DefDatabase<ThoughtDef>.GetNamedSilentFail(witnessThoughtDefName) : null;
|
||||
|
||||
// Exhibitionist pawn
|
||||
if (xxx.has_quirk(pawn, "Exhibitionist"))
|
||||
{ pawnThoughtDef = DefDatabase<ThoughtDef>.GetNamedSilentFail(pawnThoughtDefName + "Exhibitionist"); }
|
||||
|
||||
// Voyeuristic witness
|
||||
if (xxx.has_quirk(witness, "Voyeur"))
|
||||
{ witnessThoughtDef = DefDatabase<ThoughtDef>.GetNamedSilentFail(witnessThoughtDefName + "Voyeur"); }
|
||||
|
||||
// Mediating cirumstances
|
||||
bool sexIsRitual = pawn.GetLord() != null && pawn.GetLord().LordJob is LordJob_Ritual && witness?.Ideo == pawn?.Ideo;
|
||||
bool sexIsParty = pawn.GetLord() != null && pawn.GetLord().LordJob is LordJob_Joinable_Party;
|
||||
bool pawnIsVictim = pawn.CurJob.def == xxx.gettin_raped || pawn.Dead;
|
||||
bool pawnIsCheating = sexIsRitual == false && sexIsParty == false && pawnIsVictim == false && PawnIsCheatingOnPartner(pawn, witness);
|
||||
|
||||
// Wipe thoughts if pawn is a victim
|
||||
if (pawnIsVictim)
|
||||
{
|
||||
pawnThoughtDef = null;
|
||||
witnessThoughtDef = null;
|
||||
}
|
||||
|
||||
// Add thought if pawn is cheating
|
||||
if (pawnIsCheating)
|
||||
{
|
||||
if (pawn.needs.mood.thoughts.memories.GetFirstMemoryOfDef(DefDatabase<ThoughtDef>.GetNamedSilentFail("CaughtCheating")) == null)
|
||||
{ pawn.needs.mood.thoughts.memories.TryGainMemory(DefDatabase<ThoughtDef>.GetNamedSilentFail("CaughtCheating"), witness); }
|
||||
|
||||
if (witness.needs.mood.thoughts.memories.GetFirstMemoryOfDef(ThoughtDefOf.CheatedOnMe) == null)
|
||||
{ witness.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.CheatedOnMe, pawn); }
|
||||
|
||||
witnessJoiningSex = false;
|
||||
}
|
||||
|
||||
// Determine if there are any issues with the sex event and the witness' morals
|
||||
Precept precept = null;
|
||||
|
||||
if (sexIsRitual == false && sexIsParty == false && pawnIsVictim == false)
|
||||
{ witnessThoughtDef = GetThoughtsAboutSexAct(witness, pawn.jobs.curDriver as JobDriver_Sex, out precept); }
|
||||
|
||||
// Apply thoughts to witness
|
||||
if (witnessThoughtDef != null)
|
||||
{
|
||||
witness.needs.mood.thoughts.memories.TryGainMemory(witnessThoughtDef, pawn, precept);
|
||||
|
||||
if (witnessThoughtDef.stages[0].baseMoodEffect < 0)
|
||||
{ witness?.TryGetComp<CompPawnSexData>()?.TryToExclaim(); }
|
||||
|
||||
witnessJoiningSex = witnessThoughtDef.hediff != null ? false : witnessJoiningSex;
|
||||
}
|
||||
|
||||
// Extreme reaction
|
||||
if (witnessThoughtDef?.hediff != null)
|
||||
{ TriggerReactionInWitness(witness, pawn, witnessThoughtDef.hediff.defName); }
|
||||
|
||||
else if (pawnIsCheating)
|
||||
{ TriggerReactionInWitness(witness, pawn, "Indignant"); }
|
||||
|
||||
// Apply thoughts to pawn
|
||||
if (pawnThoughtDef != null)
|
||||
{
|
||||
pawn.needs.mood.thoughts.memories.TryGainMemory(pawnThoughtDef, witness, null);
|
||||
|
||||
if (pawnThoughtDef.stages[0].baseMoodEffect < 0)
|
||||
{ pawn?.TryGetComp<CompPawnSexData>()?.TryToExclaim(); }
|
||||
}
|
||||
|
||||
return witnessJoiningSex;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue