From 91d05d0e1e38ec02b52f210fe4cd4d41da663f48 Mon Sep 17 00:00:00 2001 From: c0ffee12 Date: Sun, 25 Jul 2021 21:06:00 -0700 Subject: [PATCH] null partner bugfix --- .../C0ffee's RJW Ideology Addons.dll | Bin 10752 -> 10752 bytes C0ffee's RJW Ideology Addons.csproj | 3 + C0ffee's RJW Ideology Addons.sln | 6 ++ CRIALactation/CRIALactation.csproj | 83 ++++++++++++++++++ .../Defs/PreceptDefs/Precepts_Lactating.xml | 48 ++++++++++ CRIALactation/Properties/AssemblyInfo.cs | 36 ++++++++ .../Source/HediffDefOf/HediffDefOf_Milk.cs | 26 ++++++ CRIALactation/Source/LactationUtility.cs | 24 +++++ .../Source/Precepts/Precept_Lactation.cs | 22 +++++ ...oughtWorker_Precept_Lactating_Essential.cs | 38 ++++++++ LoadFolders.xml | 9 ++ Source/CRIAUtility.cs | 13 ++- ...HarmonyPatch_JobDriver_SexBaseInitiator.cs | 7 +- 13 files changed, 312 insertions(+), 3 deletions(-) create mode 100644 CRIALactation/CRIALactation.csproj create mode 100644 CRIALactation/Defs/PreceptDefs/Precepts_Lactating.xml create mode 100644 CRIALactation/Properties/AssemblyInfo.cs create mode 100644 CRIALactation/Source/HediffDefOf/HediffDefOf_Milk.cs create mode 100644 CRIALactation/Source/LactationUtility.cs create mode 100644 CRIALactation/Source/Precepts/Precept_Lactation.cs create mode 100644 CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential.cs create mode 100644 LoadFolders.xml diff --git a/1.3/Assemblies/C0ffee's RJW Ideology Addons.dll b/1.3/Assemblies/C0ffee's RJW Ideology Addons.dll index 1bbab8c0bbbf96c9b1a9816a45e666948894303b..d1834d1008f72d86d55ae8b49bb8fe74154fc098 100644 GIT binary patch delta 3501 zcmai03viTI6+Y+w&;2(n+07dQ*@QZr6Tb_OlcwsvR-hU(CcbQq}*rsE8+R;gh|EI17vgWtWoyhg2m@_+w1 z-#Pc(bI(2Z|F?H#@5*oV>CVT0`*Z)3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.csproj b/C0ffee's RJW Ideology Addons.csproj index 79779f7..3dfff1b 100644 --- a/C0ffee's RJW Ideology Addons.csproj +++ b/C0ffee's RJW Ideology Addons.csproj @@ -76,5 +76,8 @@ + + + \ No newline at end of file diff --git a/C0ffee's RJW Ideology Addons.sln b/C0ffee's RJW Ideology Addons.sln index 661fc99..ab67cc7 100644 --- a/C0ffee's RJW Ideology Addons.sln +++ b/C0ffee's RJW Ideology Addons.sln @@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.31205.134 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "C0ffee's RJW Ideology Addons", "C0ffee's RJW Ideology Addons.csproj", "{D46BAA34-7459-482F-B152-321C071DCE18}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CRIALactation", "CRIALactation\CRIALactation.csproj", "{01BE0D84-9292-4F89-90FC-647B66771C61}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +17,10 @@ Global {D46BAA34-7459-482F-B152-321C071DCE18}.Debug|Any CPU.Build.0 = Debug|Any CPU {D46BAA34-7459-482F-B152-321C071DCE18}.Release|Any CPU.ActiveCfg = Release|Any CPU {D46BAA34-7459-482F-B152-321C071DCE18}.Release|Any CPU.Build.0 = Release|Any CPU + {01BE0D84-9292-4F89-90FC-647B66771C61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {01BE0D84-9292-4F89-90FC-647B66771C61}.Debug|Any CPU.Build.0 = Debug|Any CPU + {01BE0D84-9292-4F89-90FC-647B66771C61}.Release|Any CPU.ActiveCfg = Release|Any CPU + {01BE0D84-9292-4F89-90FC-647B66771C61}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CRIALactation/CRIALactation.csproj b/CRIALactation/CRIALactation.csproj new file mode 100644 index 0000000..f5b60bd --- /dev/null +++ b/CRIALactation/CRIALactation.csproj @@ -0,0 +1,83 @@ + + + + + Debug + AnyCPU + {01BE0D84-9292-4F89-90FC-647B66771C61} + Library + Properties + CRIALactation + CRIALactation + v4.7.2 + 512 + true + + + false + none + false + 1.3\Assemblies\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\..\..\..\..\workshop\content\294100\2009463077\Current\Assemblies\0Harmony.dll + False + + + ..\..\..\RimWorldWin64_Data\Managed\Assembly-CSharp.dll + False + + + ..\..\..\..\..\workshop\content\294100\818773962\v1.3\Assemblies\HugsLib.dll + False + + + ..\..\rjw-mc-master\1.3\Assemblies\Milk.dll + False + + + ..\..\rjw\1.3\Assemblies\RJW.dll + False + + + + + + + + + + + ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.dll + False + + + ..\..\..\RimWorldWin64_Data\Managed\UnityEngine.CoreModule.dll + False + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/CRIALactation/Defs/PreceptDefs/Precepts_Lactating.xml b/CRIALactation/Defs/PreceptDefs/Precepts_Lactating.xml new file mode 100644 index 0000000..fbfe6f0 --- /dev/null +++ b/CRIALactation/Defs/PreceptDefs/Precepts_Lactating.xml @@ -0,0 +1,48 @@ + + + + + + diff --git a/CRIALactation/Properties/AssemblyInfo.cs b/CRIALactation/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7dd9a9c --- /dev/null +++ b/CRIALactation/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CRIALactation")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CRIALactation")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("01be0d84-9292-4f89-90fc-647b66771c61")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CRIALactation/Source/HediffDefOf/HediffDefOf_Milk.cs b/CRIALactation/Source/HediffDefOf/HediffDefOf_Milk.cs new file mode 100644 index 0000000..385dfd3 --- /dev/null +++ b/CRIALactation/Source/HediffDefOf/HediffDefOf_Milk.cs @@ -0,0 +1,26 @@ +using RimWorld; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace CRIALactation +{ + [DefOf] + public static class HediffDefOf_Milk { + static HediffDefOf_Milk() + { + DefOfHelper.EnsureInitializedInCtor(typeof(HediffDefOf_Milk)); + } + + public static HediffDef Lactating_Drug; + public static HediffDef Lactating_Permanent; + public static HediffDef Heavy_Lactating_Permanent; + public static HediffDef Lactating_Natural; + + + + } +} diff --git a/CRIALactation/Source/LactationUtility.cs b/CRIALactation/Source/LactationUtility.cs new file mode 100644 index 0000000..acb859f --- /dev/null +++ b/CRIALactation/Source/LactationUtility.cs @@ -0,0 +1,24 @@ +using Milk; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; + +namespace CRIALactation +{ + public static class LactationUtility + { + + public static bool IsLactating(Pawn p) + { + + return + p.health.hediffSet.HasHediff(HediffDefOf_Milk.Lactating_Natural, false) || + p.health.hediffSet.HasHediff(HediffDefOf_Milk.Lactating_Drug, false) || + p.health.hediffSet.HasHediff(HediffDefOf_Milk.Lactating_Permanent, false) || + p.health.hediffSet.HasHediff(HediffDefOf_Milk.Heavy_Lactating_Permanent, false); + } + } +} diff --git a/CRIALactation/Source/Precepts/Precept_Lactation.cs b/CRIALactation/Source/Precepts/Precept_Lactation.cs new file mode 100644 index 0000000..b83741d --- /dev/null +++ b/CRIALactation/Source/Precepts/Precept_Lactation.cs @@ -0,0 +1,22 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using RimWorld; +using rjw; +using Milk; +using UnityEngine; + +namespace CRIALactation +{ + public class Precept_Lactation : Precept + { + + public override void Notify_MemberSpawned(Pawn pawn) + { + base.Notify_MemberSpawned(pawn); + } + + } +} diff --git a/CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential.cs b/CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential.cs new file mode 100644 index 0000000..801e8bf --- /dev/null +++ b/CRIALactation/Source/Thoughts/ThoughtWorker_Precept_Lactating_Essential.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Verse; +using RimWorld; +using rjw; +using Milk; +using UnityEngine; + +namespace CRIALactation +{ + public class ThoughtWorker_Precept_Lactating_Essential : ThoughtWorker_Precept + { + + protected override ThoughtState ShouldHaveThought(Pawn p) + { + if (ThoughtUtility.ThoughtNullified(p, this.def)) + { + return false; + } + + + if (!Genital_Helper.has_breasts(p) || Genital_Helper.has_male_breasts(p)) + { + return false; + } + + if(LactationUtility.IsLactating(p)) + { + return ThoughtState.ActiveAtStage(0); + } + + return ThoughtState.ActiveAtStage(1); + + } + } +} diff --git a/LoadFolders.xml b/LoadFolders.xml new file mode 100644 index 0000000..8132fec --- /dev/null +++ b/LoadFolders.xml @@ -0,0 +1,9 @@ + + + +
  • /
  • +
  • 1.3
  • +
  • CRIALactation
  • +
  • CRIALactation/1.3
  • +
    +
    diff --git a/Source/CRIAUtility.cs b/Source/CRIAUtility.cs index 16c5dcd..5758c75 100644 --- a/Source/CRIAUtility.cs +++ b/Source/CRIAUtility.cs @@ -19,7 +19,11 @@ namespace C0ffee_s_RJW_Ideology_Addons if (fucker == fucked) return true; //pawns are always allowed to masturbate - if (DesignatorsData.rjwComfort.Contains(fucker) || DesignatorsData.rjwComfort.Contains(fucked)) return true; //designated comfort pawns allowed to have sex with + if (DesignatorsData.rjwComfort.Contains(fucked)) return true; //designated comfort pawns allowed to have sex with + + if (fucked.IsSlaveOfColony || fucked.IsPrisonerOfColony) return true; //prisoners and slaves are free game + + if (PawnsAreDesperate(fucker, fucked)) return true; if (!IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucker) || !IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucked)) { @@ -43,5 +47,12 @@ namespace C0ffee_s_RJW_Ideology_Addons return true; } + public static bool PawnsAreDesperate(Pawn fucker, Pawn fucked) + { + if ((IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucker) || xxx.is_frustrated(fucker) && (IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed, fucked) || xxx.is_frustrated(fucked)))) return true; //frustrated pawns have to have sex + + return false; + } + } } diff --git a/Source/Patches/RJW/LovinEventDefs/HarmonyPatch_JobDriver_SexBaseInitiator.cs b/Source/Patches/RJW/LovinEventDefs/HarmonyPatch_JobDriver_SexBaseInitiator.cs index 3faa72c..b49c233 100644 --- a/Source/Patches/RJW/LovinEventDefs/HarmonyPatch_JobDriver_SexBaseInitiator.cs +++ b/Source/Patches/RJW/LovinEventDefs/HarmonyPatch_JobDriver_SexBaseInitiator.cs @@ -21,13 +21,13 @@ namespace C0ffee_s_RJW_Ideology_Addons HistoryEventDef def = __instance.pawn.relations.DirectRelationExists(PawnRelationDefOf.Spouse, __instance.Partner) ? HistoryEventDefOf.GotLovin_Spouse : HistoryEventDefOf.GotLovin_NonSpouse; - if (!(__instance is JobDriver_Rape && IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner))) //ensure raped pawns don't enjoy + if (!(IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner) && (__instance.Partner.IsSlaveOfColony || __instance.Partner.IsPrisonerOfColony))) //ensure raped pawns don't enjoy { Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.GotLovin, __instance.Partner.Named(HistoryEventArgsNames.Doer)), true); Find.HistoryEventsManager.RecordEvent(new HistoryEvent(def, __instance.Partner.Named(HistoryEventArgsNames.Doer)), true); } - if (IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner) || !(__instance is JobDriver_Rape)) //ensure raped pawns don't enjoy + if (IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.pawn) || !(__instance.Partner.IsSlaveOfColony || __instance.Partner.IsPrisonerOfColony)) //ensure slaves are free game, but not otherwise { Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.GotLovin, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true); Find.HistoryEventsManager.RecordEvent(new HistoryEvent(def, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true); @@ -45,6 +45,9 @@ namespace C0ffee_s_RJW_Ideology_Addons public static void Prefix(JobDriver_SexBaseInitiator __instance) { + if (__instance is JobDriver_Masturbate || __instance.Partner == null) return; + + if (IdeoUtility.DoerWillingToDo(HistoryEventDefOf.SharedBed_NonSpouse, __instance.Partner) || !(__instance is JobDriver_Rape)) //ensure raped pawns don't enjoy { Find.HistoryEventsManager.RecordEvent(new HistoryEvent(HistoryEventDefOf.InitiatedLovin, __instance.pawn.Named(HistoryEventArgsNames.Doer)), true);