diff --git a/Languages/English/Keyed/RJW_Sexperience.xml b/Languages/English/Keyed/RJW_Sexperience.xml
index 8b08c9d..13dbd14 100644
--- a/Languages/English/Keyed/RJW_Sexperience.xml
+++ b/Languages/English/Keyed/RJW_Sexperience.xml
@@ -55,9 +55,9 @@
Had best sex {0}.
- Main
- Sex records
- Debug
+ Main
+ Sex records
+ Debug
Enable record randomizer
@@ -90,6 +90,8 @@
If enabled boobjobs, footjobs and handjobs that happens near cum bucket will fill it
Debug
Enable debug logs
+ [Caution] Enable Sex History*
+ * Needs a game restart\n\nEnables Sex History window, information collection for the said window and save/load of this information. Also enables sex partners count in pawn's records.\n\n[Caution] Disabling this mid save will result in the loss of previously collected histories.
Reset to default
diff --git a/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs b/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs
index 1106519..45d17b2 100644
--- a/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs
+++ b/RJWSexperience/RJWSexperience/ExtensionMethods/PawnExtensions.cs
@@ -81,12 +81,11 @@ namespace RJWSexperience
///
public static void PoptheCherry(this Pawn pawn, Pawn partner, SexProps props)
{
- if (props != null && props.sexType == xxx.rjwSextype.Vaginal)
+ if (props?.sexType == xxx.rjwSextype.Vaginal)
{
if (pawn.IsVirgin())
{
- SexHistoryComp history = pawn.TryGetComp();
- history?.RecordFirst(partner, props);
+ pawn.TryGetComp()?.RecordFirst(partner, props);
if (RJWUtility.RemoveVirginTrait(pawn, partner, props))
{
Messages.Message(Keyed.RS_LostVirgin(pawn.LabelShort, partner.LabelShort), MessageTypeDefOf.NeutralEvent, true);
diff --git a/RJWSexperience/RJWSexperience/Harmony.cs b/RJWSexperience/RJWSexperience/Harmony.cs
index d3a74d6..8fb813b 100644
--- a/RJWSexperience/RJWSexperience/Harmony.cs
+++ b/RJWSexperience/RJWSexperience/Harmony.cs
@@ -16,6 +16,7 @@ namespace RJWSexperience
{
var har = new Harmony("RJW_Sexperience");
har.PatchAll(Assembly.GetExecutingAssembly());
+ Pawn_GetGizmos.DoConditionalPatch(har);
InjectIntoRjwInteractionServices();
}
diff --git a/RJWSexperience/RJWSexperience/Keyed.cs b/RJWSexperience/RJWSexperience/Keyed.cs
index 76f7ba9..f301488 100644
--- a/RJWSexperience/RJWSexperience/Keyed.cs
+++ b/RJWSexperience/RJWSexperience/Keyed.cs
@@ -59,9 +59,9 @@ namespace RJWSexperience
public static readonly string RS_LastSex = "RS_LastSex".Translate();
[MayRequireRoyalty] public static readonly string Slave = "Slave".Translate();
- public static readonly string TabLabelMain = "TabLabelMain".Translate();
- public static readonly string TabLabelHistory = "TabLabelHistory".Translate();
- public static readonly string TabLabelDebug = "TabLabelDebug".Translate();
+ public static readonly string TabLabelMain = "RSTabLabelMain".Translate();
+ public static readonly string TabLabelHistory = "RSTabLabelHistory".Translate();
+ public static readonly string TabLabelDebug = "RSTabLabelDebug".Translate();
public static readonly string Option_1_Label = "RSOption_1_Label".Translate();
public static readonly string Option_1_Desc = "RSOption_1_Desc".Translate();
@@ -93,6 +93,8 @@ namespace RJWSexperience
public static readonly string Option_SexCanFillBuckets_Desc = "RSOption_SexCanFillBuckets_Desc".Translate();
public static readonly string Option_Debug_Label = "RSOption_Debug_Label".Translate();
public static readonly string Option_Debug_Desc = "RSOption_Debug_Desc".Translate();
+ public static readonly string Option_EnableSexHistory_Label = "RSOption_EnableSexHistory_Label".Translate();
+ public static readonly string Option_EnableSexHistory_Desc = "RSOption_EnableSexHistory_Desc".Translate();
public static readonly string Button_ResetToDefault = "Button_ResetToDefault".Translate();
public static string Translate(this PartnerOrderMode mode)
diff --git a/RJWSexperience/RJWSexperience/Patches/DefInjection.cs b/RJWSexperience/RJWSexperience/Patches/DefInjection.cs
index a975ad2..65047a0 100644
--- a/RJWSexperience/RJWSexperience/Patches/DefInjection.cs
+++ b/RJWSexperience/RJWSexperience/Patches/DefInjection.cs
@@ -10,7 +10,8 @@ namespace RJWSexperience
{
static DefInjection()
{
- InjectRaces();
+ if (SexperienceMod.Settings.History.EnableSexHistory)
+ InjectRaces();
}
private static void InjectRaces()
diff --git a/RJWSexperience/RJWSexperience/Patches/GetGizmos.cs b/RJWSexperience/RJWSexperience/Patches/GetGizmos.cs
index 5cdf052..2c3b3e3 100644
--- a/RJWSexperience/RJWSexperience/Patches/GetGizmos.cs
+++ b/RJWSexperience/RJWSexperience/Patches/GetGizmos.cs
@@ -1,12 +1,25 @@
using HarmonyLib;
+using RJWSexperience.Logs;
using System.Collections.Generic;
+using System.Reflection;
using Verse;
namespace RJWSexperience
{
- [HarmonyPatch(typeof(Pawn), "GetGizmos")]
public static class Pawn_GetGizmos
{
+ public static void DoConditionalPatch(Harmony harmony)
+ {
+ if (!SexperienceMod.Settings.History.EnableSexHistory)
+ return;
+
+ MethodInfo original = typeof(Pawn).GetMethod(nameof(Pawn.GetGizmos));
+ MethodInfo postfix = typeof(Pawn_GetGizmos).GetMethod(nameof(Pawn_GetGizmos.Postfix));
+ harmony.Patch(original, postfix: new HarmonyMethod(postfix));
+
+ LogManager.GetLogger(nameof(Pawn_GetGizmos)).Message("Applied conditional patch to Pawn.GetGizmos()");
+ }
+
public static void Postfix(ref IEnumerable __result, Pawn __instance)
{
if (Find.Selector.NumSelected > 1)
diff --git a/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs b/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs
index 4485b64..f771ae0 100644
--- a/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs
+++ b/RJWSexperience/RJWSexperience/Patches/RJW_Patch.cs
@@ -64,7 +64,7 @@ namespace RJWSexperience
LustUtility.UpdateLust(props, satisfaction, base_sat_per_fuck);
FillCumBuckets(props);
props.pawn.records?.Increment(VariousDefOf.OrgasmCount);
- if (props.partner != null)
+ if (SexperienceMod.Settings.History.EnableSexHistory && props.partner != null)
props.pawn.TryGetComp()?.RecordSatisfaction(props.partner, props, satisfaction);
}
@@ -165,7 +165,7 @@ namespace RJWSexperience
{
RJWUtility.UpdateSextypeRecords(props);
- if (props.partner == null)
+ if (!SexperienceMod.Settings.History.EnableSexHistory || props.partner == null)
return;
props.pawn.TryGetComp()?.RecordSex(props.partner, props);
diff --git a/RJWSexperience/RJWSexperience/Settings/SettingsTabHistory.cs b/RJWSexperience/RJWSexperience/Settings/SettingsTabHistory.cs
index 354f49a..d266a48 100644
--- a/RJWSexperience/RJWSexperience/Settings/SettingsTabHistory.cs
+++ b/RJWSexperience/RJWSexperience/Settings/SettingsTabHistory.cs
@@ -18,6 +18,7 @@ namespace RJWSexperience.Settings
public const float MinSexablePercentDefault = 0.2f;
public const float VirginRatioDefault = 0.01f;
public const bool SlavesBeenRapedExpDefault = true;
+ public const bool EnableSexHistoryDefault = true;
// Private attributes
private bool enableRecordRandomizer = EnableStatRandomizerDefault;
@@ -29,6 +30,7 @@ namespace RJWSexperience.Settings
private float minSexablePercent = MinSexablePercentDefault;
private float virginRatio = VirginRatioDefault;
private bool slavesBeenRapedExp = SlavesBeenRapedExpDefault;
+ private bool enableSexHistory = EnableSexHistoryDefault;
//Public read-only properties
public bool EnableRecordRandomizer => enableRecordRandomizer;
@@ -40,6 +42,7 @@ namespace RJWSexperience.Settings
public float MinSexablePercent => minSexablePercent;
public float VirginRatio => virginRatio;
public bool SlavesBeenRapedExp => slavesBeenRapedExp;
+ public bool EnableSexHistory => enableSexHistory;
public static SettingsTabHistory CreateDefault()
{
@@ -59,6 +62,7 @@ namespace RJWSexperience.Settings
minSexablePercent = MinSexablePercentDefault;
virginRatio = VirginRatioDefault;
slavesBeenRapedExp = SlavesBeenRapedExpDefault;
+ enableSexHistory = EnableSexHistoryDefault;
}
public void ExposeData()
@@ -72,6 +76,7 @@ namespace RJWSexperience.Settings
Scribe_Values.Look(ref minSexablePercent, "MinSexablePercent", MinSexablePercentDefault);
Scribe_Values.Look(ref virginRatio, "VirginRatio", VirginRatioDefault);
Scribe_Values.Look(ref slavesBeenRapedExp, "SlavesBeenRapedExp", SlavesBeenRapedExpDefault);
+ Scribe_Values.Look(ref enableSexHistory, "EnableSexHistory", EnableSexHistoryDefault);
}
public void DoTabContents(Rect inRect)
@@ -106,6 +111,8 @@ namespace RJWSexperience.Settings
listmain.EndSection(section);
}
+ listmain.CheckboxLabeled(Keyed.Option_EnableSexHistory_Label, ref enableSexHistory, Keyed.Option_EnableSexHistory_Desc);
+
if (listmain.ButtonText(Keyed.Button_ResetToDefault))
{
Reset();