mirror of
https://gitgud.io/AbstractConcept/privacy-please.git
synced 2024-08-15 00:03:18 +00:00
v 0.01
This commit is contained in:
parent
55402b9891
commit
03e634e56c
36 changed files with 866 additions and 491 deletions
|
@ -11,19 +11,19 @@ using HarmonyLib;
|
|||
|
||||
namespace Privacy_Please
|
||||
{
|
||||
public static class PawnExtension
|
||||
{
|
||||
public static bool IsInBed(this Pawn pawn, out Building bed)
|
||||
{
|
||||
public static class PawnExtension
|
||||
{
|
||||
public static bool IsInBed(this Pawn pawn, out Building bed)
|
||||
{
|
||||
bed = pawn.Position.GetThingList(pawn.Map).FirstOrDefault(x => x is Building_Bed) as Building;
|
||||
return bed != null;
|
||||
}
|
||||
|
||||
public static bool IsSeated(this Pawn pawn, out Building seat)
|
||||
{
|
||||
public static bool IsSeated(this Pawn pawn, out Building seat)
|
||||
{
|
||||
seat = pawn.Position.GetThingList(pawn.Map).FirstOrDefault(x => x is Building && x.def.building.isSittable) as Building;
|
||||
return seat != null;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsHavingSex(this Pawn pawn)
|
||||
{
|
||||
|
@ -82,9 +82,9 @@ namespace Privacy_Please
|
|||
|
||||
if (pawn?.jobs?.curDriver == null || (pawn.jobs.curDriver is JobDriver_Sex) == false)
|
||||
{ return participants; }
|
||||
|
||||
|
||||
if (pawn.GetSexReceiver() != null)
|
||||
{
|
||||
{
|
||||
List<Pawn> partners = (pawn.GetSexReceiver().jobs.curDriver as JobDriver_SexBaseReciever).parteners.ToList();
|
||||
|
||||
if (partners != null)
|
||||
|
@ -96,17 +96,17 @@ namespace Privacy_Please
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (pawn.GetSexInitiator() != null)
|
||||
{
|
||||
Pawn partner = (pawn.GetSexInitiator().jobs.curDriver as JobDriver_SexBaseInitiator).Partner;
|
||||
|
||||
|
||||
if (partner != null && partner.Dead == false)
|
||||
{ participants.AddDistinct(partner); }
|
||||
}
|
||||
|
||||
participants.AddDistinct(pawn);
|
||||
|
||||
|
||||
participants.AddDistinct(pawn);
|
||||
|
||||
return participants;
|
||||
}
|
||||
|
||||
|
@ -119,121 +119,23 @@ namespace Privacy_Please
|
|||
return lovers.Any(x => x.otherPawn == other);
|
||||
}
|
||||
|
||||
public static bool HasPrivacy(this Pawn pawn, float radius)
|
||||
//public static bool GetThoughtOnIssue(this Pawn pawn, string issueDefName, out Precept precept)
|
||||
//{
|
||||
|
||||
//}
|
||||
|
||||
public static Precept GetPreceptForIssue(this Pawn pawn, IssueDef issueDef)
|
||||
{
|
||||
if (pawn.UnworriedAboutHumanSex() == false)
|
||||
{ return true; }
|
||||
if (issueDef == null || pawn?.Ideo == null)
|
||||
{ return null; }
|
||||
|
||||
if (pawn.IsHavingSex() == false && pawn.IsMasturbating() == false)
|
||||
{ return true; }
|
||||
|
||||
if (pawn.GetLord() != null && (pawn.GetLord().LordJob is LordJob_Ritual || pawn.GetLord().LordJob is LordJob_Joinable_Party) && BasicSettings.ignoreRitualAndPartySex)
|
||||
{ return true; }
|
||||
|
||||
bool hasPrivacy = true;
|
||||
pawn.IsInBed(out Building bed);
|
||||
|
||||
foreach (Thing thing in GenRadial.RadialDistinctThingsAround(pawn.Position, pawn.Map, radius, true))
|
||||
foreach (Precept precept in pawn.Ideo.PreceptsListForReading)
|
||||
{
|
||||
Pawn witness = thing as Pawn;
|
||||
if (witness == null) continue;
|
||||
|
||||
// Caught having sex
|
||||
if (SexInteractionUtility.PawnCaughtLovinByWitness(pawn, witness))
|
||||
{
|
||||
// Try to invite intruder to join in
|
||||
if (SexInteractionUtility.InvitePasserbyForSex(pawn, witness, out bool brokeTaboo))
|
||||
{
|
||||
if (pawn.IsMasturbating())
|
||||
{
|
||||
if (bed == null)
|
||||
{
|
||||
Job job = new Job(xxx.quick_sex, pawn);
|
||||
witness.jobs.TryTakeOrderedJob(job);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Job job = new Job(xxx.casual_sex, pawn, bed);
|
||||
witness.jobs.TryTakeOrderedJob(job);
|
||||
}
|
||||
}
|
||||
|
||||
else if (pawn.GetSexReceiver() != null)
|
||||
{
|
||||
Job job = new Job(DefDatabase<JobDef>.GetNamed("JoinInSex", false), pawn.GetSexReceiver(), bed);
|
||||
witness.jobs.TryTakeOrderedJob(job);
|
||||
}
|
||||
}
|
||||
|
||||
// Voyeurs and cuckolds like to watch
|
||||
else if (CasualSex_Helper.CanHaveSex(witness) && xxx.IsTargetPawnOkay(witness) &&
|
||||
(xxx.has_quirk(witness, "Voyeur") || (xxx.has_quirk(witness, "Cuckold") && SexInteractionUtility.SexParticipantsIncludesACheatingPartner(witness, pawn.GetAllSexParticipants()))))
|
||||
{
|
||||
Job job = new Job(DefDatabase<JobDef>.GetNamed("WatchSex", false), pawn.GetSexReceiver(), bed);
|
||||
witness.jobs.TryTakeOrderedJob(job);
|
||||
}
|
||||
|
||||
// Do nothing if witness is a lover and no taboo was not broken
|
||||
else if (brokeTaboo == false && witness.IsLoverOfOther(pawn))
|
||||
{ }
|
||||
|
||||
// Privacy was breached
|
||||
else
|
||||
{ hasPrivacy = false; }
|
||||
}
|
||||
if (precept.def.issue == issueDef)
|
||||
{ return precept; }
|
||||
}
|
||||
|
||||
return BasicSettings.needPrivacy == false ||
|
||||
hasPrivacy ||
|
||||
xxx.has_quirk(pawn, "Exhibitionist") ||
|
||||
pawn?.ideo?.Ideo.HasPrecept(ModPreceptDefOf.Exhibitionism_Acceptable) == true ||
|
||||
pawn?.ideo?.Ideo.HasPrecept(ModPreceptDefOf.Exhibitionism_Approved) == true;
|
||||
}
|
||||
|
||||
public static bool HasPreceptForIssue(this Pawn pawn, string issueDefName, out Precept precept)
|
||||
{
|
||||
precept = null;
|
||||
|
||||
if (pawn?.Ideo == null)
|
||||
{ return false; }
|
||||
|
||||
foreach (Precept _precept in pawn.Ideo.PreceptsListForReading)
|
||||
{
|
||||
if (_precept.def.issue.defName == issueDefName)
|
||||
{
|
||||
precept = _precept;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool EnjoysViolence(this Pawn pawn)
|
||||
{
|
||||
if (pawn.IsAnimal() || pawn.RaceProps.IsMechanoid)
|
||||
{ return true; }
|
||||
|
||||
if (pawn?.story?.traits?.allTraits == null || pawn?.story?.traits?.allTraits.NullOrEmpty() == true)
|
||||
{ return false; }
|
||||
|
||||
List<string> traits = new List<string>() { "Brawler", "Psychopath", "Bloodlust" };
|
||||
|
||||
return pawn.story.traits.allTraits.Any(x => traits.Contains(x.def.defName));
|
||||
}
|
||||
|
||||
public static bool DislikesViolence(this Pawn pawn)
|
||||
{
|
||||
if (pawn.IsAnimal() || pawn.RaceProps.IsMechanoid)
|
||||
{ return false; }
|
||||
|
||||
if (pawn?.story?.traits?.allTraits == null || pawn?.story?.traits?.allTraits.NullOrEmpty() == true)
|
||||
{ return false; }
|
||||
|
||||
List<string> traits = new List<string>() { "Kind", "Wimp" };
|
||||
|
||||
return pawn.WorkTagIsDisabled(WorkTags.Violent) || pawn.story.traits.allTraits.Any(x => traits.Contains(x.def.defName));
|
||||
return null;
|
||||
}
|
||||
|
||||
public static bool HasTrait(this Pawn pawn, string trait)
|
||||
|
@ -260,14 +162,45 @@ namespace Privacy_Please
|
|||
return pawn.story.traits.HasTrait(traitDef);
|
||||
}
|
||||
|
||||
public static bool UnworriedAboutHumanSex(this Pawn pawn)
|
||||
public static bool IsUnfazedBySex(this Pawn pawn)
|
||||
{
|
||||
return (pawn.Dead ||
|
||||
pawn.AnimalOrWildMan() ||
|
||||
pawn.RaceProps.IsMechanoid ||
|
||||
if (pawn.Dead ||
|
||||
pawn.AnimalOrWildMan() ||
|
||||
pawn.RaceProps.IsMechanoid ||
|
||||
pawn.Awake() == false ||
|
||||
pawn.Suspended == false ||
|
||||
(pawn.Faction != null && pawn.Faction.HostileTo(Faction.OfPlayer))) == false;
|
||||
pawn.Suspended)
|
||||
{ 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;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsPartOfRitualOrGathering(this Pawn pawn)
|
||||
{
|
||||
return pawn.GetLord() != null && (pawn.GetLord().LordJob is LordJob_Ritual || pawn.GetLord().LordJob is LordJob_Joinable_Party);
|
||||
}
|
||||
|
||||
public static bool IsVictim(this Pawn pawn)
|
||||
{
|
||||
return pawn.CurJob.def == xxx.gettin_raped || pawn.Dead;
|
||||
}
|
||||
|
||||
public static bool IsExhibitionist(this Pawn pawn)
|
||||
{
|
||||
return xxx.has_quirk(pawn, "Exhibitionist") || pawn?.ideo?.Ideo.HasPrecept(ModPreceptDefOf.Exhibitionism_Approved) == true;
|
||||
}
|
||||
|
||||
public static bool IsVoyeur(this Pawn pawn)
|
||||
{
|
||||
return xxx.has_quirk(pawn, "Voyeur");
|
||||
}
|
||||
|
||||
public static bool IsCuckold(this Pawn pawn)
|
||||
{
|
||||
return xxx.has_quirk(pawn, "Cuckold");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue