diff --git a/1.4/Assemblies/Privacy-Please.dll b/1.4/Assemblies/Privacy-Please.dll index 65a0d21..263b6bc 100644 Binary files a/1.4/Assemblies/Privacy-Please.dll and b/1.4/Assemblies/Privacy-Please.dll differ diff --git a/1.4/Assemblies/Privacy-Please.pdb b/1.4/Assemblies/Privacy-Please.pdb index 11e3bf9..88cfb36 100644 Binary files a/1.4/Assemblies/Privacy-Please.pdb and b/1.4/Assemblies/Privacy-Please.pdb differ diff --git a/Defs/HediffDefs.xml b/Defs/HediffDefs.xml index 6d1f207..504b57a 100644 --- a/Defs/HediffDefs.xml +++ b/Defs/HediffDefs.xml @@ -6,6 +6,7 @@ Disquiet This person saw something that upset them and it's weighting on their thoughts. + false
  • @@ -18,6 +19,7 @@ Panicked This person saw something that has shaked them to their core. Will they run or fight? + false
  • @@ -30,6 +32,7 @@ Nauseated This poor soul saw something something so utterly foul that they just might be sick from the thought. + false
  • @@ -42,6 +45,7 @@ Indignant This person witnessed something quite distasteful and is going to give the offender a piece of their mind. + false
  • diff --git a/Defs/PreceptDef_Exhibitionism.xml b/Defs/PreceptDefs/PreceptDef_Exhibitionism.xml similarity index 59% rename from Defs/PreceptDef_Exhibitionism.xml rename to Defs/PreceptDefs/PreceptDef_Exhibitionism.xml index 6dd9d64..35cedca 100644 --- a/Defs/PreceptDef_Exhibitionism.xml +++ b/Defs/PreceptDefs/PreceptDef_Exhibitionism.xml @@ -8,24 +8,13 @@ - - Exhibitionism_Forbidden - Exhibitionism - - Physical intimacy in the presence of others is a wicked thing. - High - 50 - 1000 - 100 - - Exhibitionism_Disapproved Exhibitionism - Performing sexual acts in front of others is shameful. + Being seen having sex is shameful. Low - 40 + 30 1000 100 @@ -34,9 +23,9 @@ Exhibitionism_Acceptable Exhibitionism - Sex a normal and natural event and should attract no special attention from others. + Sex infront of others is normal and deserves no special attention. Low - 30 + 20 1000 100 @@ -45,9 +34,9 @@ Exhibitionism_Approved Exhibitionism - Sex is to be celebrated and people should be encouraged to witness it. + Physical intimacy is to be celebrated. Medium - 20 + 10 1000 100 diff --git a/Defs/PreceptDefs/PreceptDef_Infidelity.xml b/Defs/PreceptDefs/PreceptDef_Infidelity.xml new file mode 100644 index 0000000..187241f --- /dev/null +++ b/Defs/PreceptDefs/PreceptDef_Infidelity.xml @@ -0,0 +1,44 @@ + + + + + Infidelity + + UI/Issues/Exhibitionism + + + + + Infidelity_Heartbreaking + Infidelity + + test + Low + 30 + 1000 + 100 + + + + Infidelity_Disapproved + Infidelity + + test + Low + 20 + 1000 + 100 + + + + Infidelity_Acceptable + Infidelity + + test + Low + 10 + 1000 + 100 + + + \ No newline at end of file diff --git a/Defs/SexActReactionDefs.xml b/Defs/SexActReactionDefs.xml new file mode 100644 index 0000000..69d2962 --- /dev/null +++ b/Defs/SexActReactionDefs.xml @@ -0,0 +1,166 @@ + + + + + reactionToExhibitionism + Exhibitionism + SexActIsExhibitionism + + SawExhibitionism_Disapproved + +
  • SawExhibitionism_Disapproved
  • +
  • SawExhibitionism_Acceptable
  • +
  • SawExhibitionism_Approved
  • + + +
  • + Voyeur + SawExhibitionism_Approved +
  • +
    + + + + + reactionToMasturbation + Masturbation + SexActIsMasturbation + + SawMasturbation_Disapproved + +
  • SawMasturbation_Abhorrent
  • +
  • SawMasturbation_Disapproved
  • +
  • SawMasturbation_Acceptable
  • +
    + +
  • + Voyeur + SawMasturbation_Approved +
  • +
    +
    +
    + + + reactionToInfidelity + Infidelity + SexActIsInfidelity + + SawInfidelity_Heartbreaking + +
  • SawInfidelity_Heartbreaking
  • +
  • SawInfidelity_Disapproved
  • +
  • SawInfidelity_Acceptable
  • +
    + +
  • + Cuckold + SawInfidelity_Approved +
  • +
    +
    +
    + + + reactionToXenophilia + HAR_AlienDating + SexActIsRape + + SawHAR_AlienDating_Acceptable + +
  • SawHAR_AlienDating_Prohibited
  • +
  • SawHAR_AlienDating_Horrible
  • +
  • SawHAR_AlienDating_Acceptable
  • +
  • SawHAR_AlienDating_Preferred
  • +
  • SawHAR_AlienDating_Know_Honorable
  • +
    + +
  • + + 1 + + SawHAR_AlienDating_Prohibited +
  • +
  • + + -1 + + SawHAR_AlienDating_Know_Honorable +
  • +
    +
    +
    + + + reactionToBestiality + Bestiality + SexActIsBestiality + + SawBestiality_Abhorrent + +
  • SawBestiality_Abhorrent
  • +
  • SawBestiality_Horrible
  • +
  • SawBestiality_Disapproved
  • +
  • SawBestiality_Acceptable
  • +
  • SawBestiality_Honorable
  • +
    + +
  • + +
  • Zoophile
  • + + SawBestiality_Honorable + +
    +
    +
    + + + reactionToNecrophilia + Necrophilia + SexActIsNecrophilia + + SawNecrophilia_Abhorrent + +
  • SawNecrophilia_Abhorrent
  • +
  • SawNecrophilia_Horrible
  • +
  • SawNecrophilia_Disapproved
  • +
  • SawNecrophilia_Acceptable
  • +
  • SawNecrophilia_Honorable
  • +
    + +
  • + +
  • Necrophiliac
  • + + SawNecrophilia_Honorable + +
    +
    +
    + + + reactionToRape + Rape + SexActIsRape + + SawRape_Abhorrent + +
  • SawRape_Abhorrent
  • +
  • SawRape_Horrible
  • +
  • SawRape_Disapproved
  • +
  • SawRape_Acceptable
  • +
  • SawRape_Honorable
  • +
    + +
  • + +
  • Rapist
  • + + SawRape_Honorable + +
    +
    +
    + + \ No newline at end of file diff --git a/Defs/ThoughtDefs/ThoughtDefsBeastiality.xml b/Defs/ThoughtDefs/ThoughtDefsBeastiality.xml index cf2bb43..8195103 100644 --- a/Defs/ThoughtDefs/ThoughtDefsBeastiality.xml +++ b/Defs/ThoughtDefs/ThoughtDefsBeastiality.xml @@ -2,14 +2,10 @@ - + SawBestiality_Abhorrent 3 3 - -
  • Zoophile
  • -
    - Panicked 1
  • @@ -18,16 +14,16 @@ -20
  • -
    - - - SawBestiality_Horrible - 3 - 3
  • Zoophile
  • - Disquiet + Outrage + + + + SawBestiality_Horrible + 3 + 3 1
  • @@ -36,16 +32,16 @@ -15
  • -
    - - - SawBestiality_Disapproved - 3 - 3
  • Zoophile
  • - Disquiet + Discomfort + + + + SawBestiality_Disapproved + 3 + 3 1
  • @@ -54,15 +50,16 @@ -10
  • -
    - - - SawBestiality_Acceptable - 3 - 3
  • Zoophile
  • + Discomfort + + + + SawBestiality_Acceptable + 3 + 3 1
  • @@ -71,13 +68,13 @@ -4
  • - -
  • Exhibitionism_Acceptable
  • -
  • Exhibitionism_Approved
  • -
    -
    + +
  • Zoophile
  • +
    + Acceptance + - + SawBestiality_Honorable 3 3 @@ -89,6 +86,7 @@ +2
    - + Approval + diff --git a/Defs/ThoughtDefs/ThoughtDefsExhibitionism.xml b/Defs/ThoughtDefs/ThoughtDefsExhibitionism.xml new file mode 100644 index 0000000..b222d05 --- /dev/null +++ b/Defs/ThoughtDefs/ThoughtDefsExhibitionism.xml @@ -0,0 +1,53 @@ + + + + + + SawExhibitionism_Disapproved + Thought_Memory + 1.0 + 1 + 0.5 + +
  • + + test + -4 +
  • +
    + Discomfort +
    + + + SawExhibitionism_Acceptable + Thought_Memory + 1.0 + 1 + 0.5 + +
  • + + test + 0 +
  • +
    + Acceptance +
    + + + SawExhibitionism_Approved + Thought_Memory + 1.0 + 1 + 0.5 + +
  • + + test + 2 +
  • +
    + Approval +
    + +
    diff --git a/Defs/ThoughtDefs/ThoughtDefsIncest.xml b/Defs/ThoughtDefs/ThoughtDefsInfidelity.xml similarity index 56% rename from Defs/ThoughtDefs/ThoughtDefsIncest.xml rename to Defs/ThoughtDefs/ThoughtDefsInfidelity.xml index 7901e74..4f93c76 100644 --- a/Defs/ThoughtDefs/ThoughtDefsIncest.xml +++ b/Defs/ThoughtDefs/ThoughtDefsInfidelity.xml @@ -2,8 +2,8 @@ - + + 1 + + Approval + diff --git a/Defs/ThoughtDefs/ThoughtDefsMasturbation.xml b/Defs/ThoughtDefs/ThoughtDefsMasturbation.xml index fa5def5..8916705 100644 --- a/Defs/ThoughtDefs/ThoughtDefsMasturbation.xml +++ b/Defs/ThoughtDefs/ThoughtDefsMasturbation.xml @@ -2,7 +2,7 @@ - + SawMasturbation_Abhorrent 3 3 @@ -14,10 +14,11 @@ You'll go blind you know! -15 - - + + Outrage + - + SawMasturbation_Disapproved Thought_Memory 1.0 @@ -30,10 +31,39 @@ -5 - -
  • Exhibitionism_Acceptable
  • -
  • Exhibitionism_Approved
  • -
    -
    + Discomfort + + + + SawMasturbation_Acceptable + Thought_Memory + 1.0 + 1 + 0.5 + +
  • + + Argh! I'm so sorry! + -5 +
  • +
    + Acceptance +
    + + + SawMasturbation_Approved + Thought_Memory + 1.0 + 1 + 0.5 + +
  • + + Argh! I'm so sorry! + -5 +
  • +
    + Approval +
    diff --git a/Defs/ThoughtDefs/ThoughtDefsNecrophilia.xml b/Defs/ThoughtDefs/ThoughtDefsNecrophilia.xml index 831913e..a2ec228 100644 --- a/Defs/ThoughtDefs/ThoughtDefsNecrophilia.xml +++ b/Defs/ThoughtDefs/ThoughtDefsNecrophilia.xml @@ -2,14 +2,10 @@ - + SawNecrophilia_Abhorrent 3 3 - -
  • Necrophiliac
  • -
    - Nauseated 1
  • @@ -18,16 +14,16 @@ -20
  • -
    - - - SawNecrophilia_Horrible - 3 - 3
  • Necrophiliac
  • - Disquiet + Outrage + + + + SawNecrophilia_Horrible + 3 + 3 1
  • @@ -36,16 +32,16 @@ -15
  • -
    - - - SawNecrophilia_Disapproved - 3 - 3
  • Necrophiliac
  • - Disquiet + Discomfort + + + + SawNecrophilia_Disapproved + 3 + 3 1
  • @@ -54,9 +50,13 @@ -10
  • -
    + +
  • Necrophiliac
  • +
    + Discomfort + - + SawNecrophilia_Acceptable 3 3 @@ -66,15 +66,15 @@ I just hope they bury it when they're done. -4 - + - -
  • Exhibitionism_Acceptable
  • -
  • Exhibitionism_Approved
  • -
    -
    + +
  • Necrophiliac
  • +
    + Acceptance + - + SawNecrophilia_Honorable 3 3 @@ -86,6 +86,7 @@ +2 - + Approval +
    diff --git a/Defs/ThoughtDefs/ThoughtDefsRape.xml b/Defs/ThoughtDefs/ThoughtDefsRape.xml index 3e3d569..8996411 100644 --- a/Defs/ThoughtDefs/ThoughtDefsRape.xml +++ b/Defs/ThoughtDefs/ThoughtDefsRape.xml @@ -2,14 +2,10 @@ - + SawRape_Abhorrent 3 3 - -
  • Rapist
  • -
    - Panicked 1
  • @@ -18,16 +14,16 @@ -20
  • -
    - - - SawRape_Horrible - 3 - 3
  • Rapist
  • - Disquiet + Outrage + + + + SawRape_Horrible + 3 + 3 1
  • @@ -36,27 +32,31 @@ -15
  • -
    - - - SawRape_Disapproved - 3 - 3
  • Rapist
  • - Disquiet + Discomfort + + + + SawRape_Disapproved + 3 + 3 1
  • - Is this what life is going to be here? + Is this what life is going to be like here? -10
  • -
    + +
  • Rapist
  • +
    + Discomfort + - + SawRape_Acceptable 3 3 @@ -68,13 +68,13 @@ -4 - -
  • Exhibitionism_Acceptable
  • -
  • Exhibitionism_Approved
  • -
    -
    + +
  • Rapist
  • +
    + Acceptance + - + SawRape_Honorable 3 3 @@ -86,6 +86,7 @@ +2 - + Approval +
    diff --git a/Defs/ThoughtDefs/ThoughtDefsXenophilia.xml b/Defs/ThoughtDefs/ThoughtDefsXenophilia.xml index 3159094..f5f8249 100644 --- a/Defs/ThoughtDefs/ThoughtDefsXenophilia.xml +++ b/Defs/ThoughtDefs/ThoughtDefsXenophilia.xml @@ -2,7 +2,7 @@ - + SawHAR_AlienDating_Prohibited 3 3 @@ -15,9 +15,13 @@ -15 - + + -1 + + Outrage + - + SawHAR_AlienDating_Horrible 3 3 @@ -30,9 +34,13 @@ -10 - + + -1 + + Discomfort + - + SawHAR_AlienDating_Acceptable 3 3 @@ -44,13 +52,13 @@ -4 - -
  • Exhibitionism_Acceptable
  • -
  • Exhibitionism_Approved
  • -
    -
    + + 1 + + Acceptance + - + SawHAR_AlienDating_Preferred 3 3 @@ -62,9 +70,13 @@ +1 - + + 1 + + Approval + - + SawHAR_AlienDating_Know_Honorable 3 3 @@ -76,6 +88,10 @@ +2 - + + 1 + + Approval +
    diff --git a/Defs/junk.txt b/Defs/junk.txt new file mode 100644 index 0000000..09e6a0d --- /dev/null +++ b/Defs/junk.txt @@ -0,0 +1,59 @@ +bool isXenophobe = pawn.HasTrait("Xenophobia") && pawn.story.traits.DegreeOfTrait(DefDatabase.GetNamedSilentFail("Xenophobia")) > 0; +bool isXenophile = pawn.HasTrait("Xenophobia") && pawn.story.traits.DegreeOfTrait(DefDatabase.GetNamedSilentFail("Xenophobia")) < 0; + +public static ThoughtDef GetThoughtsAboutSexAct(Pawn pawn, JobDriver_Sex jobDriver, out Precept precept) + { + ThoughtDef thoughtDef = null; + precept = null; + + if (pawn == null || jobDriver == null) return null; + if (BasicSettings.slavesIgnoreSex && (pawn.IsPrisoner || pawn.IsSlave)) return null; + if (BasicSettings.otherFactionsIgnoreSex && pawn.Faction.IsPlayer == false) return null; + + + if (BasicSettings.worryAboutNecro && sexIsNecro && xxx.is_necrophiliac(pawn) == false) + { + thoughtDef = xxx.is_necrophiliac(pawn) ? DefDatabase.GetNamedSilentFail("SawNecrophilia_Honorable") : + pawn.HasPreceptForIssue("Necrophilia", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : + DefDatabase.GetNamedSilentFail("SawNecrophilia_Abhorrent"); + } + + else if (BasicSettings.worryAboutBeastiality && sexIsBeastial) + { + thoughtDef = xxx.is_zoophile(pawn) ? DefDatabase.GetNamedSilentFail("SawBeastility_Honorable") : + pawn.HasPreceptForIssue("Beastility", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : + DefDatabase.GetNamedSilentFail("SawBeastility_Abhorrent"); + } + + else if (BasicSettings.worryAboutRape && BasicSettings.ignoreSlaveRape == false && sexIsSlaveRape) + { + thoughtDef = xxx.is_rapist(pawn) ? DefDatabase.GetNamedSilentFail("SawRape_Honorable") : + pawn.HasPreceptForIssue("Rape", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : + DefDatabase.GetNamedSilentFail("SawRape_Abhorrent"); + } + + else if (BasicSettings.worryAboutRape && sexIsRape) + { + thoughtDef = xxx.is_rapist(pawn) ? DefDatabase.GetNamedSilentFail("SawRape_Honorable") : + pawn.HasPreceptForIssue("Rape", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : + DefDatabase.GetNamedSilentFail("SawRape_Abhorrent"); + } + + else if (BasicSettings.worryAboutXeno && sexIsXeno) + { + thoughtDef = isXenophobe ? DefDatabase.GetNamedSilentFail("SawHAR_AlienDating_Prohibited") : + isXenophile ? DefDatabase.GetNamedSilentFail("SawHAR_AlienDating_Honorable") : + pawn.HasPreceptForIssue("HAR_AlienDating", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : + DefDatabase.GetNamedSilentFail("SawHAR_AlienDating_Acceptable"); + } + + else if (BasicSettings.worryAboutMasturbation && sexIsSolo) + { + thoughtDef = pawn.HasPreceptForIssue("Masturbation", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : + DefDatabase.GetNamedSilentFail("SawMasturbation_Disapproved"); + } + + 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; + } \ No newline at end of file diff --git a/Source/.vs/AbsCon_PrivacyPlease/v16/.suo b/Source/.vs/AbsCon_PrivacyPlease/v16/.suo deleted file mode 100644 index 68d23ad..0000000 Binary files a/Source/.vs/AbsCon_PrivacyPlease/v16/.suo and /dev/null differ diff --git a/Source/.vs/SourceCode/v16/.suo b/Source/.vs/SourceCode/v16/.suo new file mode 100644 index 0000000..2b885e7 Binary files /dev/null and b/Source/.vs/SourceCode/v16/.suo differ diff --git a/Source/Scripts/Defs/SexActReactionDef.cs b/Source/Scripts/Defs/SexActReactionDef.cs new file mode 100644 index 0000000..72e2eee --- /dev/null +++ b/Source/Scripts/Defs/SexActReactionDef.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using RimWorld; +using rjw; + +namespace Privacy_Please +{ + public class SexActReactionDef : Def + { + public string issueDefName; + public string sexActCheck; + public SubSexActReactionDef pawnReaction; + public SubSexActReactionDef witnessReaction; + + private IssueDef _issueDef; + private bool _checkedForIssueDef; + + public IssueDef issueDef + { + get + { + if (_checkedForIssueDef == false) + { _issueDef = DefDatabase.GetNamedSilentFail(issueDefName); _checkedForIssueDef = true; } + + return _issueDef; + } + } + + public class SubSexActReactionDef + { + public SexActThoughtDef defaultThoughtDef; + public List associatedThoughtDefs; + public List replacementThoughts; + } + + public class ReplacementThought + { + public List requiredTraits; + public string requiredQuirk; + public SexActThoughtDef replacementThoughtDef; + } + + public ReactionToSexAct DetermineReactionOfPawns(Pawn pawn, Pawn witness, bool applyThoughtDefs) + { + DetermineReactionOfPawn(pawn, witness, pawnReaction, applyThoughtDefs); + ReactionToSexAct reactionToSexAct = DetermineReactionOfPawn(witness, pawn, witnessReaction, applyThoughtDefs); + + return reactionToSexAct; + } + + public ReactionToSexAct DetermineReactionOfPawn(Pawn reactor, Pawn otherPawn, SubSexActReactionDef reaction, bool applyThoughtDef) + { + SexActThoughtDef thoughtDef = GetThoughtDefForReactor(reactor, reaction, out Precept precept); + ReactionToSexAct reactionToSexAct = thoughtDef.reactionToSexAct; + + if (applyThoughtDef) + { reactor.needs.mood.thoughts.memories.TryGainMemory(thoughtDef, otherPawn, precept); } + + var nullifyingTraits = ThoughtUtility.GetNullifyingTraits(thoughtDef)?.ToList(); + + if (thoughtDef.stages[0].baseMoodEffect < 0 && nullifyingTraits?.Any(x => x.HasTrait(reactor)) != true) + { reactor.TryGetComp()?.TryToExclaim(); } + + return reactionToSexAct; + } + + private SexActThoughtDef GetThoughtDefForReactor(Pawn reactor, SubSexActReactionDef reaction, out Precept precept) + { + precept = null; + + if (reactor == null || reaction == null) return null; + + if (reaction.replacementThoughts.NullOrEmpty() == false) + { + foreach (ReplacementThought replacementThought in reaction.replacementThoughts) + { + if (replacementThought?.requiredTraits.Any(x => x.HasTrait(reactor)) == true) + { return replacementThought.replacementThoughtDef; } + + if (replacementThought.requiredQuirk != null && xxx.has_quirk(reactor, replacementThought.requiredQuirk)) + { return replacementThought.replacementThoughtDef; } + } + } + + precept = reactor.GetPreceptForIssue(issueDef); + + if (precept != null && reaction.associatedThoughtDefs.NullOrEmpty() == false) + { + string thoughtDefName = precept.def.defName; + + foreach (SexActThoughtDef associatedThoughtDef in reaction.associatedThoughtDefs) + { + if (associatedThoughtDef.defName.Contains(thoughtDefName)) + { return associatedThoughtDef; } + } + } + + return reaction.defaultThoughtDef; + } + } +} diff --git a/Source/Scripts/Defs/SexActThoughtDef.cs b/Source/Scripts/Defs/SexActThoughtDef.cs new file mode 100644 index 0000000..7777366 --- /dev/null +++ b/Source/Scripts/Defs/SexActThoughtDef.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RimWorld; + +namespace Privacy_Please +{ + public class SexActThoughtDef : ThoughtDef + { + public ReactionToSexAct reactionToSexAct = ReactionToSexAct.Acceptance; + } +} diff --git a/Source/Scripts/Extensions/PawnExtension.cs b/Source/Scripts/Extensions/PawnExtension.cs index 0345fa7..503f9b3 100644 --- a/Source/Scripts/Extensions/PawnExtension.cs +++ b/Source/Scripts/Extensions/PawnExtension.cs @@ -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 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.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.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 traits = new List() { "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 traits = new List() { "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"); } } } diff --git a/Source/Scripts/Patches/HarmonyPatch_PatchAll.cs b/Source/Scripts/Patches/HarmonyPatch_PatchAll.cs index 11e0f77..e9547f4 100644 --- a/Source/Scripts/Patches/HarmonyPatch_PatchAll.cs +++ b/Source/Scripts/Patches/HarmonyPatch_PatchAll.cs @@ -15,7 +15,7 @@ namespace Privacy_Please { static Harmony_PatchAll() { - Harmony harmony = new Harmony("Rimworld_Animations_Patch"); + Harmony harmony = new Harmony("Privacy_Please"); harmony.PatchAll(Assembly.GetExecutingAssembly()); // Add quirks to game @@ -24,6 +24,8 @@ namespace Privacy_Please Quirk cuckold = new Quirk("Cuckold", "CuckoldQuirk"); Quirk.All.AddDistinct(cuckold); + + DebugMode.Message("Added RJW quirks"); } } } diff --git a/Source/Scripts/Patches/HarmonyPatch_RJW.cs b/Source/Scripts/Patches/HarmonyPatch_RJW.cs index 53bc867..3d5912a 100644 --- a/Source/Scripts/Patches/HarmonyPatch_RJW.cs +++ b/Source/Scripts/Patches/HarmonyPatch_RJW.cs @@ -31,7 +31,7 @@ namespace Privacy_Please foreach (Thing thing in GenRadial.RadialDistinctThingsAround(pawn.Position, pawn.Map, radius, true)) { Pawn other = thing as Pawn; - ThoughtDef thoughtDef = SexInteractionUtility.GetThoughtsAboutSexAct(other, __instance, out Precept precept); + ThoughtDef thoughtDef = null; // SexInteractionUtility.GetThoughtsAboutSexAct(other, __instance, out Precept precept); // Find candidates to invite if (other != null && thoughtDef?.hediff == null && SexInteractionUtility.CouldInvitePasserbyForSex(other, pawn.GetAllSexParticipants())) @@ -64,7 +64,7 @@ namespace Privacy_Please { if (pawn.IsHashIntervalTick(90)) { - if (pawn.IsMasturbating() && pawn.HasPrivacy(8f) == false) + if (pawn.IsMasturbating() && PrivacyUtility.PawnHasPrivacy(pawn, 8f) == false) { pawn.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false); } else if (pawn.IsHavingSex()) @@ -74,7 +74,7 @@ namespace Privacy_Please foreach (Pawn participant in participants) { - if (participant.HasPrivacy(8f) == false) + if (PrivacyUtility.PawnHasPrivacy(participant, 8f) == false) { havePrivacy = false; } } diff --git a/Source/Scripts/Utilities/DebugMode.cs b/Source/Scripts/Utilities/DebugMode.cs index 6709e9f..fd42bd1 100644 --- a/Source/Scripts/Utilities/DebugMode.cs +++ b/Source/Scripts/Utilities/DebugMode.cs @@ -10,7 +10,7 @@ namespace Privacy_Please public static void Message(string text) { if (BasicSettings.debugMode) - { Log.Message("[DEBUG] " + text); } + { Log.Message("[Privacy, Please!] " + text); } } } } diff --git a/Source/Scripts/Utilities/Enums.cs b/Source/Scripts/Utilities/Enums.cs new file mode 100644 index 0000000..dc7da1b --- /dev/null +++ b/Source/Scripts/Utilities/Enums.cs @@ -0,0 +1,10 @@ +namespace Privacy_Please +{ + public enum ReactionToSexAct + { + Approval = 1, + Acceptance = 0, + Discomfort = -1, + Outrage = -2, + } +} diff --git a/Source/Scripts/Utilities/PrivacyUtility.cs b/Source/Scripts/Utilities/PrivacyUtility.cs new file mode 100644 index 0000000..b8abc44 --- /dev/null +++ b/Source/Scripts/Utilities/PrivacyUtility.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using RimWorld; +using Verse; +using Verse.AI; +using Verse.AI.Group; +using rjw; + +namespace Privacy_Please +{ + public static class PrivacyUtility + { + public static bool PawnHasPrivacy(Pawn pawn, float radius) + { + //if (pawn.IsUnfazedBySex()) + //{ return true; } + + 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)) + { + 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.GetReactionToSexAct(witness, pawn.jobs.curDriver as JobDriver_Sex) >= (int)ReactionToSexAct.Acceptance) + { + // TODO roll for sex + + 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.GetNamed("WatchSex", false), pawn.GetSexReceiver(), bed); + witness.jobs.TryTakeOrderedJob(job); + } + + else 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.GetNamed("JoinInSex", false), pawn.GetSexReceiver(), bed); + witness.jobs.TryTakeOrderedJob(job); + } + } + + else + { hasPrivacy = false; } + } + } + + 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; + } + } +} diff --git a/Source/Scripts/Utilities/SexInteractionUtility.cs b/Source/Scripts/Utilities/SexInteractionUtility.cs index c1ea68c..aca5842 100644 --- a/Source/Scripts/Utilities/SexInteractionUtility.cs +++ b/Source/Scripts/Utilities/SexInteractionUtility.cs @@ -6,6 +6,7 @@ using Verse.AI.Group; using RimWorld; using rjw; using UnityEngine; +using HarmonyLib; namespace Privacy_Please { @@ -13,10 +14,12 @@ namespace Privacy_Please { public static bool PawnCaughtLovinByWitness(Pawn pawn, Pawn witness) { + return true; + if (witness == null || pawn == witness || (pawn.IsMasturbating() == false && pawn.IsHavingSex() == false) || - witness.UnworriedAboutHumanSex() == false || + witness.IsUnfazedBySex() == false || witness.CanSee(pawn) == false) { return false; } @@ -25,7 +28,7 @@ namespace Privacy_Please if (sexParticipants.Contains(witness) || witnessIsApproachingSexParticipant) { return false; } - + return true; } @@ -63,7 +66,7 @@ namespace Privacy_Please { if (passerby == null || participants.Contains(passerby) || - passerby.UnworriedAboutHumanSex() == false || + passerby.IsUnfazedBySex() == false || participants.All(x => x.CanSee(passerby) == false)) { return false; } @@ -90,214 +93,62 @@ namespace Privacy_Please return false; } - public static ThoughtDef GetThoughtsAboutSexAct(Pawn pawn, JobDriver_Sex jobDriver, out Precept precept) + public static ReactionToSexAct GetReactionToSexAct(Pawn witness, JobDriver_Sex jobDriver, bool applyThoughtDefs = false) { - ThoughtDef thoughtDef = null; - precept = null; - - if (pawn == null || jobDriver == null) return null; - if (BasicSettings.slavesIgnoreSex && (pawn.IsPrisoner || pawn.IsSlave)) return null; - if (BasicSettings.otherFactionsIgnoreSex && pawn.Faction.IsPlayer == false) 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.GetNamedSilentFail("Xenophobia")) > 0; - bool isXenophile = pawn.HasTrait("Xenophobia") && pawn.story.traits.DegreeOfTrait(DefDatabase.GetNamedSilentFail("Xenophobia")) < 0; - bool sexIsSolo = jobDriver.pawn.IsMasturbating(); - bool sexIsIncest = jobDriver.Partner != null && jobDriver.pawn.GetRelations(jobDriver.Partner).Any(x => x.familyByBloodRelation); - - if (BasicSettings.worryAboutNecro && sexIsNecro && xxx.is_necrophiliac(pawn) == false) - { - thoughtDef = xxx.is_necrophiliac(pawn) ? DefDatabase.GetNamedSilentFail("SawNecrophilia_Honorable") : - pawn.HasPreceptForIssue("Necrophilia", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : - DefDatabase.GetNamedSilentFail("SawNecrophilia_Abhorrent"); - } - - else if (BasicSettings.worryAboutBeastiality && sexIsBeastial) - { - thoughtDef = xxx.is_zoophile(pawn) ? DefDatabase.GetNamedSilentFail("SawBeastility_Honorable") : - pawn.HasPreceptForIssue("Beastility", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : - DefDatabase.GetNamedSilentFail("SawBeastility_Abhorrent"); - } - - else if (BasicSettings.worryAboutRape && BasicSettings.ignoreSlaveRape == false && sexIsSlaveRape) - { - thoughtDef = xxx.is_rapist(pawn) ? DefDatabase.GetNamedSilentFail("SawRape_Honorable") : - pawn.HasPreceptForIssue("Rape", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : - DefDatabase.GetNamedSilentFail("SawRape_Abhorrent"); - } - - else if (BasicSettings.worryAboutRape && sexIsRape) - { - thoughtDef = xxx.is_rapist(pawn) ? DefDatabase.GetNamedSilentFail("SawRape_Honorable") : - pawn.HasPreceptForIssue("Rape", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : - DefDatabase.GetNamedSilentFail("SawRape_Abhorrent"); - } - - else if (BasicSettings.worryAboutXeno && sexIsXeno) - { - thoughtDef = isXenophobe ? DefDatabase.GetNamedSilentFail("SawHAR_AlienDating_Prohibited") : - isXenophile ? DefDatabase.GetNamedSilentFail("SawHAR_AlienDating_Honorable") : - pawn.HasPreceptForIssue("HAR_AlienDating", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : - DefDatabase.GetNamedSilentFail("SawHAR_AlienDating_Acceptable"); - } - - else if (BasicSettings.worryAboutMasturbation && sexIsSolo) - { - thoughtDef = pawn.HasPreceptForIssue("Masturbation", out precept) ? DefDatabase.GetNamedSilentFail("Saw" + precept.def.defName) : - DefDatabase.GetNamedSilentFail("SawMasturbation_Disapproved"); - } - - else if (BasicSettings.worryAboutIncest && sexIsIncest) - { - - } - - 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 bool InvitePasserbyForSex(Pawn pawn, Pawn witness, out bool brokeTaboo) - { - brokeTaboo = false; - bool witnessJoiningSex = Random.value < BasicSettings.chanceForOtherToJoinInSex && CouldInvitePasserbyForSex(witness, pawn.GetAllSexParticipants()); - - // Exit clauses - if (witness.UnworriedAboutHumanSex() == true) - { return false; } - - // Get basic thoughts - ThoughtDef pawnThoughtDef = BasicSettings.needPrivacy ? ModThoughtDefOf.SeenHavingSex : null; - ThoughtDef witnessThoughtDef = BasicSettings.needPrivacy ? ModThoughtDefOf.SawSex : null; - - // Exhibitionist pawn (overrides needPrivacy) - if (xxx.has_quirk(pawn, "Exhibitionist") || pawn?.ideo?.Ideo.HasPrecept(ModPreceptDefOf.Exhibitionism_Approved) == true) - { pawnThoughtDef = ModThoughtDefOf.SeenHavingSexExhibitionist; } - - // Voyeuristic witness (overrides needPrivacy) - if (xxx.has_quirk(witness, "Voyeur")) - { witnessThoughtDef = ModThoughtDefOf.SawSexVoyeur; } - - // 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 mitigatingCirumstances = sexIsRitual || sexIsParty || pawnIsVictim; - bool pawnIsCheating = mitigatingCirumstances == false && PawnIsCheatingOnPartner(pawn, witness); - - // Override thoughts if pawn is a victim - if (pawnIsVictim) - { - pawnThoughtDef = null; - witnessThoughtDef = null; - } - - // Add thought if pawn is cheating - else if (pawnIsCheating) - { - if (pawn.needs.mood.thoughts.memories.GetFirstMemoryOfDef(ModThoughtDefOf.CaughtCheating) == null) - { pawn.needs.mood.thoughts.memories.TryGainMemory(ModThoughtDefOf.CaughtCheating, witness); } - - if (witness.needs.mood.thoughts.memories.GetFirstMemoryOfDef(ThoughtDefOf.CheatedOnMe) == null) - { witness.needs.mood.thoughts.memories.TryGainMemory(ThoughtDefOf.CheatedOnMe, pawn); } - - witnessJoiningSex = false; - } + Pawn pawn = jobDriver.pawn; + ReactionToSexAct reactionOfWitness = ReactionToSexAct.Acceptance; // Determine if there are any issues with the sex event and the witness' morals - ThoughtDef newWitnessThoughtDef = GetThoughtsAboutSexAct(witness, pawn.jobs.curDriver as JobDriver_Sex, out Precept precept); - - // Update their thoughts if there are no migitating circumstances or the thought provides a positive morale boost larger than the original - if (newWitnessThoughtDef != null && (mitigatingCirumstances == false || (newWitnessThoughtDef.stages[0].baseMoodEffect > 0 && newWitnessThoughtDef.stages[0].baseMoodEffect > witnessThoughtDef.stages[0].baseMoodEffect))) - { witnessThoughtDef = newWitnessThoughtDef; } - - // Apply thoughts to witness - if (witnessThoughtDef != null) + foreach (SexActReactionDef sexActReactionDef in DefDatabase.AllDefs) { - witness.needs.mood.thoughts.memories.TryGainMemory(witnessThoughtDef, pawn, precept); + var methodInfo = AccessTools.Method(typeof(SexInteractionUtility), sexActReactionDef.sexActCheck, null, null); - if (witnessThoughtDef.stages[0].baseMoodEffect < 0) - { witness?.TryGetComp()?.TryToExclaim(); } + if (methodInfo == null) + { DebugMode.Message("Method '" + sexActReactionDef.sexActCheck + "' was not found"); continue; } - witnessJoiningSex = witnessThoughtDef.hediff != null ? false : witnessJoiningSex; - brokeTaboo = witnessThoughtDef.hediff != null; - - // Trigger extreme reactions - if (witnessThoughtDef?.hediff != null) - { TriggerReactionInWitness(witness, pawn, witnessThoughtDef.hediff.defName); } - - else if (pawnIsCheating) - { TriggerReactionInWitness(witness, pawn, "Indignant"); } + if ((bool)methodInfo.Invoke(null, new object[] { jobDriver })) + { + DebugMode.Message(sexActReactionDef.defName); + reactionOfWitness = sexActReactionDef.DetermineReactionOfPawns(pawn, witness, applyThoughtDefs); + } } - // Apply thoughts to pawn - if (pawnThoughtDef != null) - { - pawn.needs.mood.thoughts.memories.TryGainMemory(pawnThoughtDef, witness, null); - - if (pawnThoughtDef.stages[0].baseMoodEffect < 0) - { pawn?.TryGetComp()?.TryToExclaim(); } - } - - return witnessJoiningSex; + return reactionOfWitness; } - public static void TriggerReactionInWitness(Pawn witness, Pawn otherPawn, string reaction) + public static bool SexActIsNecrophilia(JobDriver_Sex jobDriver) { - if (BasicSettings.majorTabooCanStartFights == false || reaction.NullOrEmpty()) - { return; } + return jobDriver.Partner != null && jobDriver.Partner.Dead; + } - if (witness.MentalState != null || - witness.jobs.curDriver is JobDriver_Flee || - witness.jobs.curDriver is JobDriver_AttackMelee || - witness.jobs.curDriver is JobDriver_Vomit) - { return; } + public static bool SexActIsBestiality(JobDriver_Sex jobDriver) + { + return jobDriver.Partner != null && jobDriver.Partner.RaceProps.Animal; + } - // 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"); } + public static bool SexActIsRape(JobDriver_Sex jobDriver) + { + return jobDriver is JobDriver_Rape || jobDriver is JobDriver_RapeEnemy || jobDriver is JobDriver_SexBaseRecieverRaped; + } - // Flight - else - { - Job job = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List() { otherPawn }, 24f), otherPawn); - witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false); - witness.jobs.StartJob(job); - } - } + public static bool SexActIsXenophilia(JobDriver_Sex jobDriver) + { + return jobDriver.Partner != null && jobDriver.Partner.def.defName != jobDriver.pawn.def.defName; + } - // Vomit - else if (reaction == "Nauseated") - { - Job jobVomit = JobMaker.MakeJob(JobDefOf.Vomit); - Job jobFlee = JobMaker.MakeJob(JobDefOf.FleeAndCower, CellFinderLoose.GetFleeDest(witness, new List() { otherPawn }, 24f), otherPawn); + public static bool SexActIsMasturbation(JobDriver_Sex jobDriver) + { + return jobDriver.pawn.IsMasturbating(); + } - witness.jobs.EndCurrentJob(JobCondition.InterruptForced, false, false); + public static bool SexActIsExhibitionism(JobDriver_Sex jobDriver) + { + return jobDriver.pawn.IsHavingSex(); + } - 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.GetNamedSilentFail("TargetedInsultingSpree"), null, true, false, null, true, false, false); - (witness.mindState.mentalStateHandler.CurState as MentalState_TargetedInsultingSpree).target = otherPawn; - } + public static bool SexActIsInfidelity(JobDriver_Sex jobDriver) + { + return jobDriver.pawn.IsHavingSex(); } } } diff --git a/Source/AbsCon_PrivacyPlease.csproj b/Source/SourceCode.csproj similarity index 94% rename from Source/AbsCon_PrivacyPlease.csproj rename to Source/SourceCode.csproj index cc28fa9..6ed663a 100644 --- a/Source/AbsCon_PrivacyPlease.csproj +++ b/Source/SourceCode.csproj @@ -38,6 +38,8 @@ + + @@ -47,7 +49,9 @@ + + diff --git a/Source/AbsCon_PrivacyPlease.sln b/Source/SourceCode.sln similarity index 86% rename from Source/AbsCon_PrivacyPlease.sln rename to Source/SourceCode.sln index 47b9d66..b1ebce8 100644 --- a/Source/AbsCon_PrivacyPlease.sln +++ b/Source/SourceCode.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30011.22 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AbsCon_PrivacyPlease", "AbsCon_PrivacyPlease.csproj", "{AC00E678-E117-4BC2-8C3E-DA26509E2F6D}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SourceCode", "SourceCode.csproj", "{AC00E678-E117-4BC2-8C3E-DA26509E2F6D}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Source/obj/Debug/AbsCon_PrivacyPlease.csproj.CoreCompileInputs.cache b/Source/obj/Debug/AbsCon_PrivacyPlease.csproj.CoreCompileInputs.cache index 5c433ef..ec591ee 100644 --- a/Source/obj/Debug/AbsCon_PrivacyPlease.csproj.CoreCompileInputs.cache +++ b/Source/obj/Debug/AbsCon_PrivacyPlease.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -8263062e6a99f43c12969425daafb3f9676b8c24 +6e370cfc279d578a4af85250025d7591e85c908b diff --git a/Source/obj/Debug/AbsCon_PrivacyPlease.csproj.FileListAbsolute.txt b/Source/obj/Debug/AbsCon_PrivacyPlease.csproj.FileListAbsolute.txt index 55f190f..9fde0ea 100644 --- a/Source/obj/Debug/AbsCon_PrivacyPlease.csproj.FileListAbsolute.txt +++ b/Source/obj/Debug/AbsCon_PrivacyPlease.csproj.FileListAbsolute.txt @@ -4,3 +4,9 @@ C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please-absco C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please-abscon\Source\obj\Debug\AbsCon_PrivacyPlease.csproj.CoreCompileInputs.cache C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please-abscon\Source\obj\Debug\Privacy-Please.dll C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please-abscon\Source\obj\Debug\Privacy-Please.pdb +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\Source\obj\Debug\AbsCon_PrivacyPlease.csprojAssemblyReference.cache +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\Source\obj\Debug\AbsCon_PrivacyPlease.csproj.CoreCompileInputs.cache +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\Source\obj\Debug\Privacy-Please.dll +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\Source\obj\Debug\Privacy-Please.pdb +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\1.4\Assemblies\Privacy-Please.dll +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\1.4\Assemblies\Privacy-Please.pdb diff --git a/Source/obj/Debug/AbsCon_PrivacyPlease.csprojAssemblyReference.cache b/Source/obj/Debug/AbsCon_PrivacyPlease.csprojAssemblyReference.cache index a89dbc1..de04efb 100644 Binary files a/Source/obj/Debug/AbsCon_PrivacyPlease.csprojAssemblyReference.cache and b/Source/obj/Debug/AbsCon_PrivacyPlease.csprojAssemblyReference.cache differ diff --git a/Source/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Source/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 409e475..cadd269 100644 Binary files a/Source/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/Source/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Source/obj/Debug/Privacy-Please.dll b/Source/obj/Debug/Privacy-Please.dll index 65a0d21..263b6bc 100644 Binary files a/Source/obj/Debug/Privacy-Please.dll and b/Source/obj/Debug/Privacy-Please.dll differ diff --git a/Source/obj/Debug/Privacy-Please.pdb b/Source/obj/Debug/Privacy-Please.pdb index 11e3bf9..88cfb36 100644 Binary files a/Source/obj/Debug/Privacy-Please.pdb and b/Source/obj/Debug/Privacy-Please.pdb differ diff --git a/Source/obj/Debug/SourceCode.csproj.CoreCompileInputs.cache b/Source/obj/Debug/SourceCode.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..6b52555 --- /dev/null +++ b/Source/obj/Debug/SourceCode.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +7168a589dcb8c6bc69e172d8ed7c3d5766de561d diff --git a/Source/obj/Debug/SourceCode.csproj.FileListAbsolute.txt b/Source/obj/Debug/SourceCode.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..f45c955 --- /dev/null +++ b/Source/obj/Debug/SourceCode.csproj.FileListAbsolute.txt @@ -0,0 +1,6 @@ +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\1.4\Assemblies\Privacy-Please.dll +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\1.4\Assemblies\Privacy-Please.pdb +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\Source\obj\Debug\SourceCode.csproj.CoreCompileInputs.cache +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\Source\obj\Debug\Privacy-Please.dll +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\Source\obj\Debug\Privacy-Please.pdb +C:\Program Files (x86)\Steam\SteamApps\common\RimWorld\Mods\privacy-please\Source\obj\Debug\SourceCode.csprojAssemblyReference.cache diff --git a/Source/obj/Debug/SourceCode.csprojAssemblyReference.cache b/Source/obj/Debug/SourceCode.csprojAssemblyReference.cache new file mode 100644 index 0000000..481df48 Binary files /dev/null and b/Source/obj/Debug/SourceCode.csprojAssemblyReference.cache differ