mirror of
				https://github.com/amevarashi/RJW-Sexperience.git
				synced 2024-08-14 23:54:08 +00:00 
			
		
		
		
	New settings handling
This commit is contained in:
		
							parent
							
								
									fed4b54915
								
							
						
					
					
						commit
						8d49addd63
					
				
					 24 changed files with 309 additions and 233 deletions
				
			
		| 
						 | 
					@ -1,64 +1,48 @@
 | 
				
			||||||
using UnityEngine;
 | 
					using Verse;
 | 
				
			||||||
using Verse;
 | 
					 | 
				
			||||||
using RJWSexperience.Settings;
 | 
					using RJWSexperience.Settings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJWSexperience
 | 
					namespace RJWSexperience
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	public class Configurations : ModSettings, ITab
 | 
						public class Configurations : ModSettings
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		public string Label => Keyed.TabLabelMain;
 | 
					 | 
				
			||||||
		public const int CurrentSettingsVersion = 1;
 | 
							public const int CurrentSettingsVersion = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Defaults
 | 
							public readonly SettingHandle<float> LustEffectPower = new SettingHandle<float>("LustEffectPower", 0.5f);
 | 
				
			||||||
		public const float LustEffectPowerDefault = 0.5f;
 | 
							public readonly SettingHandle<bool> EnableBastardRelation = new SettingHandle<bool>("EnableBastardRelation", true);
 | 
				
			||||||
		public const bool EnableBastardRelationDefault = true;
 | 
							public readonly SettingHandle<float> LustLimit = new SettingHandle<float>("LustLimit", 150f);
 | 
				
			||||||
		public const float LustLimitDefault = SettingsTabHistory.MaxLustDeviationDefault / 3f;
 | 
							public readonly SettingHandle<float> MaxSingleLustChange = new SettingHandle<float>("maxSingleLustChange", 1f);
 | 
				
			||||||
		public const float MaxSingleLustChangeDefault = 0.5f;
 | 
							public readonly SettingHandle<bool> SexCanFillBuckets = new SettingHandle<bool>("SexCanFillBuckets", false);
 | 
				
			||||||
		public const bool SexCanFillBucketsDefault = false;
 | 
					 | 
				
			||||||
		public const bool selectionLockedDefault = false;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Private attributes
 | 
							public readonly SettingHandle<bool> EnableRecordRandomizer = new SettingHandle<bool>("EnableRecordRandomizer", true);
 | 
				
			||||||
		private float lustEffectPower = LustEffectPowerDefault;
 | 
							public readonly SettingHandle<float> MaxLustDeviation = new SettingHandle<float>("MaxLustDeviation", 200f);
 | 
				
			||||||
		private bool enableBastardRelation = EnableBastardRelationDefault;
 | 
							public readonly SettingHandle<float> AvgLust = new SettingHandle<float>("AvgLust", 0f);
 | 
				
			||||||
		private float lustLimit = LustLimitDefault;
 | 
							public readonly SettingHandle<float> MaxSexCountDeviation = new SettingHandle<float>("MaxSexCountDeviation", 90f);
 | 
				
			||||||
		private float maxSingleLustChange = MaxSingleLustChangeDefault;
 | 
							public readonly SettingHandle<float> SexPerYear = new SettingHandle<float>("SexPerYear", 30f);
 | 
				
			||||||
		private bool sexCanFillBuckets = SexCanFillBucketsDefault;
 | 
							public readonly SettingHandle<bool> MinSexableFromLifestage = new SettingHandle<bool>("MinSexableFromLifestage", true);
 | 
				
			||||||
		private bool selectionLocked = selectionLockedDefault;
 | 
							public readonly SettingHandle<float> MinSexablePercent = new SettingHandle<float>("MinSexablePercent", 0.2f);
 | 
				
			||||||
		private SettingsTabHistory history = SettingsTabHistory.CreateDefault();
 | 
							public readonly SettingHandle<float> VirginRatio = new SettingHandle<float>("VirginRatio", 0.01f);
 | 
				
			||||||
		private SettingsTabDebug debug = new SettingsTabDebug();
 | 
							public readonly SettingHandle<bool> SlavesBeenRapedExp = new SettingHandle<bool>("SlavesBeenRapedExp", true);
 | 
				
			||||||
 | 
							public readonly SettingHandle<bool> EnableSexHistory = new SettingHandle<bool>("EnableSexHistory", true);
 | 
				
			||||||
 | 
							public readonly SettingHandle<bool> HideGizmoWhenDrafted = new SettingHandle<bool>("HideGizmoWhenDrafted", true);
 | 
				
			||||||
 | 
							public readonly SettingHandle<bool> HideGizmoWithRJW = new SettingHandle<bool>("HideGizmoWithRJW", false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		//Public read-only properties
 | 
							public readonly SettingHandle<bool> DevMode = new SettingHandle<bool>("DevMode", false);
 | 
				
			||||||
		public float LustEffectPower => lustEffectPower;
 | 
					 | 
				
			||||||
		public bool EnableBastardRelation => enableBastardRelation;
 | 
					 | 
				
			||||||
		public float LustLimit => lustLimit;
 | 
					 | 
				
			||||||
		public float MaxSingleLustChange => maxSingleLustChange;
 | 
					 | 
				
			||||||
		public bool SexCanFillBuckets => sexCanFillBuckets;
 | 
					 | 
				
			||||||
		public SettingsTabHistory History => history;
 | 
					 | 
				
			||||||
		public SettingsTabDebug Debug => debug;
 | 
					 | 
				
			||||||
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Minor Code Smell", "S2292:Trivial properties should be auto-implemented", Justification = "Can't scribe property")]
 | 
					 | 
				
			||||||
		public bool SelectionLocked { get => selectionLocked; set => selectionLocked = value; }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public void ResetToDefault()
 | 
							public readonly SettingHandle<bool> SelectionLocked = new SettingHandle<bool>("SelectionLocked", false);
 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			lustEffectPower = LustEffectPowerDefault;
 | 
					 | 
				
			||||||
			enableBastardRelation = EnableBastardRelationDefault;
 | 
					 | 
				
			||||||
			lustLimit = LustLimitDefault;
 | 
					 | 
				
			||||||
			maxSingleLustChange = MaxSingleLustChangeDefault;
 | 
					 | 
				
			||||||
			sexCanFillBuckets = SexCanFillBucketsDefault;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public override void ExposeData()
 | 
							public override void ExposeData()
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
								SettingsContainer history = SettingsContainer.CreateHistoryContainer(this);
 | 
				
			||||||
			int version = CurrentSettingsVersion;
 | 
								int version = CurrentSettingsVersion;
 | 
				
			||||||
			Scribe_Values.Look(ref version, "SettingsVersion", 0);
 | 
								Scribe_Values.Look(ref version, "SettingsVersion", 0);
 | 
				
			||||||
			Scribe_Values.Look(ref lustEffectPower, "LustEffectPower", LustEffectPowerDefault);
 | 
								LustEffectPower.Scribe();
 | 
				
			||||||
			Scribe_Values.Look(ref enableBastardRelation, "EnableBastardRelation", EnableBastardRelationDefault);
 | 
								EnableBastardRelation.Scribe();
 | 
				
			||||||
			Scribe_Values.Look(ref lustLimit, "LustLimit", LustLimitDefault);
 | 
								LustLimit.Scribe();
 | 
				
			||||||
			Scribe_Values.Look(ref maxSingleLustChange, "maxSingleLustChange", MaxSingleLustChangeDefault);
 | 
								MaxSingleLustChange.Scribe();
 | 
				
			||||||
			Scribe_Values.Look(ref selectionLocked, "SelectionLocked", selectionLockedDefault);
 | 
								SelectionLocked.Scribe();
 | 
				
			||||||
			Scribe_Values.Look(ref sexCanFillBuckets, "SexCanFillBuckets", SexCanFillBucketsDefault);
 | 
								SexCanFillBuckets.Scribe();
 | 
				
			||||||
			Scribe_Deep.Look(ref history, "History");
 | 
								DevMode.Scribe();
 | 
				
			||||||
			Scribe_Deep.Look(ref debug, "Debug");
 | 
								Scribe_Deep.Look(ref history, "History", history.Handles);
 | 
				
			||||||
			base.ExposeData();
 | 
								base.ExposeData();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (Scribe.mode != LoadSaveMode.LoadingVars)
 | 
								if (Scribe.mode != LoadSaveMode.LoadingVars)
 | 
				
			||||||
| 
						 | 
					@ -66,41 +50,9 @@ namespace RJWSexperience
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (history == null)
 | 
								if (history == null)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				history = new SettingsTabHistory();
 | 
					 | 
				
			||||||
				// Previously history settings were in Configurations. Direct call to try read old data
 | 
									// Previously history settings were in Configurations. Direct call to try read old data
 | 
				
			||||||
				history.ExposeData();
 | 
									SettingsContainer.CreateHistoryContainer(this).ExposeData();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (debug == null)
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
				debug = new SettingsTabDebug();
 | 
					 | 
				
			||||||
				debug.Reset();
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void DoTabContents(Rect inRect)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			const float lineHeight = SettingsWidgets.lineHeight;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			Listing_Standard listmain = new Listing_Standard();
 | 
					 | 
				
			||||||
			listmain.maxOneColumn = true;
 | 
					 | 
				
			||||||
			listmain.Begin(inRect);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_2_Label + " x" + lustEffectPower, Keyed.Option_2_Desc, ref lustEffectPower, 0f, 2f, 0.01f);
 | 
					 | 
				
			||||||
			SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_8_Label + " " + lustLimit, Keyed.Option_8_Desc, ref lustLimit, 0f, 5000f, 1f);
 | 
					 | 
				
			||||||
			SettingsWidgets.SliderOption(listmain.GetRect(lineHeight * 2f), Keyed.Option_MaxSingleLustChange_Label + " " + maxSingleLustChange, Keyed.Option_MaxSingleLustChange_Desc, ref maxSingleLustChange, 0f, 10f, 0.05f);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			listmain.CheckboxLabeled(Keyed.Option_EnableBastardRelation_Label, ref enableBastardRelation, Keyed.Option_EnableBastardRelation_Desc);
 | 
					 | 
				
			||||||
			listmain.CheckboxLabeled(Keyed.Option_SexCanFillBuckets_Label, ref sexCanFillBuckets, Keyed.Option_SexCanFillBuckets_Desc);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (SexperienceMod.Settings.Debug.DevMode)
 | 
					 | 
				
			||||||
				LustUtility.DrawGraph(listmain.GetRect(300f));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (listmain.ButtonText(Keyed.Button_ResetToDefault))
 | 
					 | 
				
			||||||
			{
 | 
					 | 
				
			||||||
				ResetToDefault();
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			listmain.End();
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -39,7 +39,7 @@ namespace RJWSexperience // Used in Menstruation with this namespace
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			stringBuilder.Append(Keyed.RSTotalGatheredCum).AppendFormat("{0:0.##}ml", totalGathered);
 | 
								stringBuilder.Append(Keyed.RSTotalGatheredCum).AppendFormat("{0:0.##}ml", totalGathered);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (SexperienceMod.Settings.Debug.DevMode)
 | 
								if (SexperienceMod.Settings.DevMode)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				stringBuilder.AppendLine();
 | 
									stringBuilder.AppendLine();
 | 
				
			||||||
				stringBuilder.AppendLine($"[Debug] stored: {StoredStackCount}");
 | 
									stringBuilder.AppendLine($"[Debug] stored: {StoredStackCount}");
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ namespace RJWSexperience
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (!allzero)
 | 
								if (!allzero)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				if (SexperienceMod.Settings.History.EnableRecordRandomizer && xxx.is_human(pawn))
 | 
									if (SexperienceMod.Settings.EnableRecordRandomizer && xxx.is_human(pawn))
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					return RecordRandomizer.Randomize(pawn);
 | 
										return RecordRandomizer.Randomize(pawn);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -4,6 +4,6 @@ namespace RJWSexperience.Logs
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	public class DebugLogProvider : ILogProvider
 | 
						public class DebugLogProvider : ILogProvider
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		public bool IsActive => SexperienceMod.Settings.Debug.DevMode;
 | 
							public bool IsActive => SexperienceMod.Settings.DevMode;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										37
									
								
								Source/RJWSexperience/Patches/ConditionalDefLoad.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Source/RJWSexperience/Patches/ConditionalDefLoad.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,37 @@
 | 
				
			||||||
 | 
					/*using HarmonyLib;
 | 
				
			||||||
 | 
					using System.Xml;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace RJWSexperience.Patches
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public static class ConditionalDefLoad
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public static void DoPatch()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Harmony harmony = new Harmony("RJW_SexperienceXmlLoad");
 | 
				
			||||||
 | 
								harmony.Patch(AccessTools.Method(typeof(DirectXmlLoader), nameof(DirectXmlLoader.DefFromNode)), new HarmonyMethod(typeof(ConditionalDefLoad), nameof(ConditionalDefLoad.Prefix)));
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public static bool Prefix(XmlNode node, LoadableXmlAsset loadingAsset, ref Def __result)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (node.NodeType != XmlNodeType.Element)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									return true;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								var settingName = node.Attributes?["RsLoadFlag"]?.Value;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (settingName.NullOrEmpty())
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									return true;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (SexperienceMod.Settings.GetValue<bool>(settingName))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									__result = null;
 | 
				
			||||||
 | 
									return false;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								return true;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}*/
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,7 @@ namespace RJWSexperience
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		static DefInjection()
 | 
							static DefInjection()
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			if (SexperienceMod.Settings.History.EnableSexHistory)
 | 
								if (SexperienceMod.Settings.EnableSexHistory)
 | 
				
			||||||
				InjectRaces();
 | 
									InjectRaces();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -9,7 +9,7 @@ namespace RJWSexperience
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	public static class Pawn_GetGizmos
 | 
						public static class Pawn_GetGizmos
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		private static Settings.SettingsTabHistory Settings => SexperienceMod.Settings.History;
 | 
							private static Configurations Settings => SexperienceMod.Settings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public static void DoConditionalPatch(Harmony harmony)
 | 
							public static void DoConditionalPatch(Harmony harmony)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -44,7 +44,7 @@ namespace RJWSexperience
 | 
				
			||||||
			LustUtility.UpdateLust(props, satisfaction, base_sat_per_fuck);
 | 
								LustUtility.UpdateLust(props, satisfaction, base_sat_per_fuck);
 | 
				
			||||||
			CumUtility.FillCumBuckets(props);
 | 
								CumUtility.FillCumBuckets(props);
 | 
				
			||||||
			props.pawn.records?.Increment(VariousDefOf.OrgasmCount);
 | 
								props.pawn.records?.Increment(VariousDefOf.OrgasmCount);
 | 
				
			||||||
			if (SexperienceMod.Settings.History.EnableSexHistory && props.partner != null)
 | 
								if (SexperienceMod.Settings.EnableSexHistory && props.partner != null)
 | 
				
			||||||
				props.pawn.TryGetComp<SexHistoryComp>()?.RecordSatisfaction(props.partner, props, satisfaction);
 | 
									props.pawn.TryGetComp<SexHistoryComp>()?.RecordSatisfaction(props.partner, props, satisfaction);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -80,7 +80,7 @@ namespace RJWSexperience
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			RJWUtility.UpdateSextypeRecords(props);
 | 
								RJWUtility.UpdateSextypeRecords(props);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (!SexperienceMod.Settings.History.EnableSexHistory || props.partner == null)
 | 
								if (!SexperienceMod.Settings.EnableSexHistory || props.partner == null)
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			props.pawn.TryGetComp<SexHistoryComp>()?.RecordSex(props.partner, props);
 | 
								props.pawn.TryGetComp<SexHistoryComp>()?.RecordSex(props.partner, props);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,7 +16,7 @@ namespace RJWSexperience
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			bool doVirginTrait = true;
 | 
								bool doVirginTrait = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (SexperienceMod.Settings.History.EnableRecordRandomizer && __result.DevelopmentalStage != DevelopmentalStage.Newborn && xxx.is_human(__result))
 | 
								if (SexperienceMod.Settings.EnableRecordRandomizer && __result.DevelopmentalStage != DevelopmentalStage.Newborn && xxx.is_human(__result))
 | 
				
			||||||
				doVirginTrait = SexHistory.RecordRandomizer.Randomize(__result);
 | 
									doVirginTrait = SexHistory.RecordRandomizer.Randomize(__result);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (doVirginTrait)
 | 
								if (doVirginTrait)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,8 +57,14 @@
 | 
				
			||||||
    <Compile Include="Logs\DebugLogProvider.cs" />
 | 
					    <Compile Include="Logs\DebugLogProvider.cs" />
 | 
				
			||||||
    <Compile Include="Logs\LogManager.cs" />
 | 
					    <Compile Include="Logs\LogManager.cs" />
 | 
				
			||||||
    <Compile Include="LustUtility.cs" />
 | 
					    <Compile Include="LustUtility.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Patches\ConditionalDefLoad.cs" />
 | 
				
			||||||
    <Compile Include="Patches\DefInjection.cs" />
 | 
					    <Compile Include="Patches\DefInjection.cs" />
 | 
				
			||||||
    <Compile Include="Patches\GetGizmos.cs" />
 | 
					    <Compile Include="Patches\GetGizmos.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Settings\ISettingHandle.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Settings\SettingHandle.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Settings\SettingsContainer.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Settings\SettingsTab.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="Settings\SettingsTabMain.cs" />
 | 
				
			||||||
    <Compile Include="Virginity\Recipe_HymenSurgery.cs" />
 | 
					    <Compile Include="Virginity\Recipe_HymenSurgery.cs" />
 | 
				
			||||||
    <Compile Include="Settings\SettingsTabHistory.cs" />
 | 
					    <Compile Include="Settings\SettingsTabHistory.cs" />
 | 
				
			||||||
    <Compile Include="Settings\SettingsTabDebug.cs" />
 | 
					    <Compile Include="Settings\SettingsTabDebug.cs" />
 | 
				
			||||||
| 
						 | 
					@ -90,7 +96,7 @@
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <PackageReference Include="Krafs.Rimworld.Ref">
 | 
					    <PackageReference Include="Krafs.Rimworld.Ref">
 | 
				
			||||||
      <Version>1.4.3524</Version>
 | 
					      <Version>1.4.3641</Version>
 | 
				
			||||||
    </PackageReference>
 | 
					    </PackageReference>
 | 
				
			||||||
    <PackageReference Include="Lib.Harmony">
 | 
					    <PackageReference Include="Lib.Harmony">
 | 
				
			||||||
      <Version>2.2.2</Version>
 | 
					      <Version>2.2.2</Version>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -15,6 +15,7 @@ namespace RJWSexperience
 | 
				
			||||||
		/// For ideo patch
 | 
							/// For ideo patch
 | 
				
			||||||
		/// </summary>
 | 
							/// </summary>
 | 
				
			||||||
		[System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "All parameters are needed for the ideology patch")]
 | 
							[System.Diagnostics.CodeAnalysis.SuppressMessage("Redundancy", "RCS1163:Unused parameter.", Justification = "All parameters are needed for the ideology patch")]
 | 
				
			||||||
 | 
							[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "All parameters are needed for the ideology patch")]
 | 
				
			||||||
		public static void ThrowVirginHistoryEvent(Pawn exVirgin, Pawn partner, SexProps props, int degree)
 | 
							public static void ThrowVirginHistoryEvent(Pawn exVirgin, Pawn partner, SexProps props, int degree)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			//for non-ideo
 | 
								//for non-ideo
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,6 @@
 | 
				
			||||||
namespace RJWSexperience.Settings
 | 
					namespace RJWSexperience.Settings
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	internal interface IResettable
 | 
						public interface IResettable
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		void Reset();
 | 
							void Reset();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										7
									
								
								Source/RJWSexperience/Settings/ISettingHandle.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								Source/RJWSexperience/Settings/ISettingHandle.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,7 @@
 | 
				
			||||||
 | 
					namespace RJWSexperience.Settings
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public interface ISettingHandle : IResettable
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							void Scribe();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										35
									
								
								Source/RJWSexperience/Settings/SettingHandle.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								Source/RJWSexperience/Settings/SettingHandle.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,35 @@
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace RJWSexperience.Settings
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public class SettingHandle<T> : ISettingHandle
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public T Value { get; set; }
 | 
				
			||||||
 | 
							public readonly string XmlLabel;
 | 
				
			||||||
 | 
							public readonly T DefaultValue;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public SettingHandle(string xmlLabel, T defaultValue)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								XmlLabel = xmlLabel;
 | 
				
			||||||
 | 
								DefaultValue = defaultValue;
 | 
				
			||||||
 | 
								Value = defaultValue;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public void Reset()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Value = DefaultValue;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public void Scribe()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								T value = Value;
 | 
				
			||||||
 | 
								Scribe_Values.Look(ref value, XmlLabel, DefaultValue);
 | 
				
			||||||
 | 
								Value = value;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public static implicit operator T(SettingHandle<T> settingHandle)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								return settingHandle.Value;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										39
									
								
								Source/RJWSexperience/Settings/SettingsContainer.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								Source/RJWSexperience/Settings/SettingsContainer.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,39 @@
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace RJWSexperience.Settings
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public class SettingsContainer : IExposable
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public List<ISettingHandle> Handles { get; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public SettingsContainer(List<ISettingHandle> handles)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Handles = handles;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public void ExposeData()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								foreach (ISettingHandle setting in Handles)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									setting.Scribe();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public static SettingsContainer CreateHistoryContainer(Configurations settings) => new SettingsContainer(new List<ISettingHandle> {
 | 
				
			||||||
 | 
									settings.EnableRecordRandomizer,
 | 
				
			||||||
 | 
									settings.MaxLustDeviation,
 | 
				
			||||||
 | 
									settings.AvgLust,
 | 
				
			||||||
 | 
									settings.MaxSexCountDeviation,
 | 
				
			||||||
 | 
									settings.SexPerYear,
 | 
				
			||||||
 | 
									settings.MinSexableFromLifestage,
 | 
				
			||||||
 | 
									settings.MinSexablePercent,
 | 
				
			||||||
 | 
									settings.VirginRatio,
 | 
				
			||||||
 | 
									settings.SlavesBeenRapedExp,
 | 
				
			||||||
 | 
									settings.EnableSexHistory,
 | 
				
			||||||
 | 
									settings.HideGizmoWhenDrafted,
 | 
				
			||||||
 | 
									settings.HideGizmoWithRJW
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										30
									
								
								Source/RJWSexperience/Settings/SettingsTab.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								Source/RJWSexperience/Settings/SettingsTab.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,30 @@
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using UnityEngine;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace RJWSexperience.Settings
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public abstract class SettingsTab : ITab, IResettable
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							protected readonly List<ISettingHandle> tabSettings;
 | 
				
			||||||
 | 
							protected readonly Configurations settings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public string Label { get; protected set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							protected SettingsTab(Configurations settings, string label, List<ISettingHandle> tabSettings)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								this.settings = settings;
 | 
				
			||||||
 | 
								Label = label;
 | 
				
			||||||
 | 
								this.tabSettings = tabSettings;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public void Reset()
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								foreach (ISettingHandle setting in tabSettings)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									setting.Reset();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public abstract void DoTabContents(Rect inRect);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1,36 +1,18 @@
 | 
				
			||||||
using UnityEngine;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using UnityEngine;
 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJWSexperience.Settings
 | 
					namespace RJWSexperience.Settings
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	public class SettingsTabDebug : IExposable, IResettable, ITab
 | 
						public class SettingsTabDebug : SettingsTab
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		public string Label => Keyed.TabLabelDebug;
 | 
							public SettingsTabDebug(Configurations settings) : base(settings, Keyed.TabLabelDebug, new List<ISettingHandle> { settings.DevMode }) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Defaults
 | 
							public override void DoTabContents(Rect inRect)
 | 
				
			||||||
		public const bool DevModeDefault = false;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Private attributes
 | 
					 | 
				
			||||||
		private bool devMode;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		//Public read-only properties
 | 
					 | 
				
			||||||
		public bool DevMode => devMode;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void Reset()
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			devMode = DevModeDefault;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void ExposeData()
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			Scribe_Values.Look(ref devMode, "DevMode", DevModeDefault);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void DoTabContents(Rect inRect)
 | 
					 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Listing_Standard listmain = new Listing_Standard();
 | 
								Listing_Standard listmain = new Listing_Standard();
 | 
				
			||||||
			listmain.Begin(inRect);
 | 
								listmain.Begin(inRect);
 | 
				
			||||||
			listmain.CheckboxLabeled(Keyed.Option_Debug_Label, ref devMode, Keyed.Option_Debug_Desc);
 | 
								listmain.CheckboxLabeled(Keyed.Option_Debug_Label, settings.DevMode, Keyed.Option_Debug_Desc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (listmain.ButtonText(Keyed.Button_ResetToDefault))
 | 
								if (listmain.ButtonText(Keyed.Button_ResetToDefault))
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,132 +1,69 @@
 | 
				
			||||||
using RimWorld;
 | 
					using RimWorld;
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
using UnityEngine;
 | 
					using UnityEngine;
 | 
				
			||||||
using Verse;
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace RJWSexperience.Settings
 | 
					namespace RJWSexperience.Settings
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	public class SettingsTabHistory : IExposable, IResettable, ITab
 | 
						public class SettingsTabHistory : SettingsTab
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		public string Label => Keyed.TabLabelHistory;
 | 
							public SettingsTabHistory(Configurations settings) : base(
 | 
				
			||||||
 | 
								settings,
 | 
				
			||||||
 | 
								Keyed.TabLabelHistory,
 | 
				
			||||||
 | 
								new List<ISettingHandle> {
 | 
				
			||||||
 | 
									settings.EnableRecordRandomizer,
 | 
				
			||||||
 | 
									settings.MaxLustDeviation,
 | 
				
			||||||
 | 
									settings.AvgLust,
 | 
				
			||||||
 | 
									settings.MaxSexCountDeviation,
 | 
				
			||||||
 | 
									settings.SexPerYear,
 | 
				
			||||||
 | 
									settings.MinSexableFromLifestage,
 | 
				
			||||||
 | 
									settings.MinSexablePercent,
 | 
				
			||||||
 | 
									settings.VirginRatio,
 | 
				
			||||||
 | 
									settings.SlavesBeenRapedExp,
 | 
				
			||||||
 | 
									settings.EnableSexHistory,
 | 
				
			||||||
 | 
									settings.HideGizmoWhenDrafted,
 | 
				
			||||||
 | 
									settings.HideGizmoWithRJW
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Defaults
 | 
							public override void DoTabContents(Rect inRect)
 | 
				
			||||||
		public const bool EnableStatRandomizerDefault = true;
 | 
					 | 
				
			||||||
		public const float MaxLustDeviationDefault = 400f;
 | 
					 | 
				
			||||||
		public const float AvgLustDefault = 0f;
 | 
					 | 
				
			||||||
		public const float MaxSexCountDeviationDefault = 90f;
 | 
					 | 
				
			||||||
		public const float SexPerYearDefault = 30f;
 | 
					 | 
				
			||||||
		public const bool MinSexableFromLifestageDefault = true;
 | 
					 | 
				
			||||||
		public const float MinSexablePercentDefault = 0.2f;
 | 
					 | 
				
			||||||
		public const float VirginRatioDefault = 0.01f;
 | 
					 | 
				
			||||||
		public const bool SlavesBeenRapedExpDefault = true;
 | 
					 | 
				
			||||||
		public const bool EnableSexHistoryDefault = true;
 | 
					 | 
				
			||||||
		public const bool HideGizmoWhenDraftedDefault = true;
 | 
					 | 
				
			||||||
		public const bool HideGizmoWithRJWDefault = true;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// Private attributes
 | 
					 | 
				
			||||||
		private bool enableRecordRandomizer = EnableStatRandomizerDefault;
 | 
					 | 
				
			||||||
		private float maxLustDeviation = MaxLustDeviationDefault;
 | 
					 | 
				
			||||||
		private float avgLust = AvgLustDefault;
 | 
					 | 
				
			||||||
		private float maxSexCountDeviation = MaxSexCountDeviationDefault;
 | 
					 | 
				
			||||||
		private float sexPerYear = SexPerYearDefault;
 | 
					 | 
				
			||||||
		private bool minSexableFromLifestage = MinSexableFromLifestageDefault;
 | 
					 | 
				
			||||||
		private float minSexablePercent = MinSexablePercentDefault;
 | 
					 | 
				
			||||||
		private float virginRatio = VirginRatioDefault;
 | 
					 | 
				
			||||||
		private bool slavesBeenRapedExp = SlavesBeenRapedExpDefault;
 | 
					 | 
				
			||||||
		private bool enableSexHistory = EnableSexHistoryDefault;
 | 
					 | 
				
			||||||
		private bool hideGizmoWhenDrafted = HideGizmoWhenDraftedDefault;
 | 
					 | 
				
			||||||
		private bool hideGizmoWithRJW = HideGizmoWithRJWDefault;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		//Public read-only properties
 | 
					 | 
				
			||||||
		public bool EnableRecordRandomizer => enableRecordRandomizer;
 | 
					 | 
				
			||||||
		public float MaxLustDeviation => maxLustDeviation;
 | 
					 | 
				
			||||||
		public float AvgLust => avgLust;
 | 
					 | 
				
			||||||
		public float MaxSexCountDeviation => maxSexCountDeviation;
 | 
					 | 
				
			||||||
		public float SexPerYear => sexPerYear;
 | 
					 | 
				
			||||||
		public bool MinSexableFromLifestage => minSexableFromLifestage;
 | 
					 | 
				
			||||||
		public float MinSexablePercent => minSexablePercent;
 | 
					 | 
				
			||||||
		public float VirginRatio => virginRatio;
 | 
					 | 
				
			||||||
		public bool SlavesBeenRapedExp => slavesBeenRapedExp;
 | 
					 | 
				
			||||||
		public bool EnableSexHistory => enableSexHistory;
 | 
					 | 
				
			||||||
		public bool HideGizmoWhenDrafted => hideGizmoWhenDrafted;
 | 
					 | 
				
			||||||
		public bool HideGizmoWithRJW => hideGizmoWithRJW;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public static SettingsTabHistory CreateDefault()
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			SettingsTabHistory history = new SettingsTabHistory();
 | 
					 | 
				
			||||||
			history.Reset();
 | 
					 | 
				
			||||||
			return history;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void Reset()
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			enableRecordRandomizer = EnableStatRandomizerDefault;
 | 
					 | 
				
			||||||
			maxLustDeviation = MaxLustDeviationDefault;
 | 
					 | 
				
			||||||
			avgLust = AvgLustDefault;
 | 
					 | 
				
			||||||
			maxSexCountDeviation = MaxSexCountDeviationDefault;
 | 
					 | 
				
			||||||
			sexPerYear = SexPerYearDefault;
 | 
					 | 
				
			||||||
			minSexableFromLifestage = MinSexableFromLifestageDefault;
 | 
					 | 
				
			||||||
			minSexablePercent = MinSexablePercentDefault;
 | 
					 | 
				
			||||||
			virginRatio = VirginRatioDefault;
 | 
					 | 
				
			||||||
			slavesBeenRapedExp = SlavesBeenRapedExpDefault;
 | 
					 | 
				
			||||||
			enableSexHistory = EnableSexHistoryDefault;
 | 
					 | 
				
			||||||
			hideGizmoWhenDrafted = HideGizmoWhenDraftedDefault;
 | 
					 | 
				
			||||||
			hideGizmoWithRJW = HideGizmoWithRJWDefault;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void ExposeData()
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			Scribe_Values.Look(ref enableRecordRandomizer, "EnableRecordRandomizer", EnableStatRandomizerDefault);
 | 
					 | 
				
			||||||
			Scribe_Values.Look(ref maxLustDeviation, "MaxLustDeviation", MaxLustDeviationDefault);
 | 
					 | 
				
			||||||
			Scribe_Values.Look(ref avgLust, "AvgLust", AvgLustDefault);
 | 
					 | 
				
			||||||
			Scribe_Values.Look(ref maxSexCountDeviation, "MaxSexCountDeviation", MaxSexCountDeviationDefault);
 | 
					 | 
				
			||||||
			Scribe_Values.Look(ref sexPerYear, "SexPerYear", SexPerYearDefault);
 | 
					 | 
				
			||||||
			Scribe_Values.Look(ref minSexableFromLifestage, "MinSexableFromLifestage", MinSexableFromLifestageDefault);
 | 
					 | 
				
			||||||
			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);
 | 
					 | 
				
			||||||
			Scribe_Values.Look(ref hideGizmoWhenDrafted, "HideGizmoWhenDrafted", HideGizmoWhenDraftedDefault);
 | 
					 | 
				
			||||||
			Scribe_Values.Look(ref hideGizmoWithRJW, "HideGizmoWithRJW", HideGizmoWithRJWDefault);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void DoTabContents(Rect inRect)
 | 
					 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			const float lineHeight = SettingsWidgets.lineHeight;
 | 
								const float lineHeight = SettingsWidgets.lineHeight;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			Listing_Standard listmain = new Listing_Standard();
 | 
								Listing_Standard listmain = new Listing_Standard();
 | 
				
			||||||
			listmain.Begin(inRect);
 | 
								listmain.Begin(inRect);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			listmain.CheckboxLabeled(Keyed.Option_1_Label, ref enableRecordRandomizer, Keyed.Option_1_Desc);
 | 
								listmain.CheckboxLabeled(Keyed.Option_1_Label, settings.EnableRecordRandomizer, Keyed.Option_1_Desc);
 | 
				
			||||||
			if (enableRecordRandomizer)
 | 
								if (settings.EnableRecordRandomizer)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				float sectionHeight = 12f;
 | 
									float sectionHeight = 12f;
 | 
				
			||||||
				if (!minSexableFromLifestage)
 | 
									if (!settings.MinSexableFromLifestage)
 | 
				
			||||||
					sectionHeight += 2f;
 | 
										sectionHeight += 2f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				Listing_Standard section = listmain.BeginSection(lineHeight * sectionHeight);
 | 
									Listing_Standard section = listmain.BeginSection(lineHeight * sectionHeight);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_3_Label + " " + maxLustDeviation, Keyed.Option_3_Desc, ref maxLustDeviation, 0f, 2000f, 1f);
 | 
									section.SliderOption(Keyed.Option_3_Label + " {0}", Keyed.Option_3_Desc, settings.MaxLustDeviation, new FloatRange(0f, 1000f), 1f);
 | 
				
			||||||
				SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_4_Label + " " + avgLust, Keyed.Option_4_Desc, ref avgLust, -1000f, 1000f, 1f);
 | 
									section.SliderOption(Keyed.Option_4_Label + " {0}", Keyed.Option_4_Desc, settings.AvgLust, new FloatRange(-200f, 200f), 1f);
 | 
				
			||||||
				SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_5_Label + " " + maxSexCountDeviation, Keyed.Option_5_Desc, ref maxSexCountDeviation, 0f, 2000f, 1f);
 | 
									section.SliderOption(Keyed.Option_5_Label + " {0}", Keyed.Option_5_Desc, settings.MaxSexCountDeviation, new FloatRange(0f, 1000f), 1f);
 | 
				
			||||||
				SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), Keyed.Option_6_Label + " " + sexPerYear, Keyed.Option_6_Desc, ref sexPerYear, 0f, 2000f, 1f);
 | 
									section.SliderOption(Keyed.Option_6_Label + " {0}", Keyed.Option_6_Desc, settings.SexPerYear, new FloatRange(0f, 2000f), 1f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				section.CheckboxLabeled(Keyed.Option_MinSexableFromLifestage_Label, ref minSexableFromLifestage, Keyed.Option_MinSexableFromLifestage_Desc);
 | 
									section.CheckboxLabeled(Keyed.Option_MinSexableFromLifestage_Label, settings.MinSexableFromLifestage, Keyed.Option_MinSexableFromLifestage_Desc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				if (!minSexableFromLifestage)
 | 
									if (!settings.MinSexableFromLifestage)
 | 
				
			||||||
					SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), $"{Keyed.Option_9_Label} {minSexablePercent:P1}   {ThingDefOf.Human.race.lifeExpectancy * minSexablePercent} human years", Keyed.Option_9_Desc, ref minSexablePercent, 0, 1, 0.001f);
 | 
										section.SliderOption($"{Keyed.Option_9_Label} {{0:P1}}  {ThingDefOf.Human.race.lifeExpectancy * settings.MinSexablePercent} human years", Keyed.Option_9_Desc, settings.MinSexablePercent, FloatRange.ZeroToOne, 0.001f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				SettingsWidgets.SliderOption(section.GetRect(lineHeight * 2f), $"{Keyed.Option_10_Label} {virginRatio:P1}", Keyed.Option_10_Desc, ref virginRatio, 0f, 1f, 0.001f);
 | 
									section.SliderOption(Keyed.Option_10_Label + " {0:P1}", Keyed.Option_10_Desc, settings.VirginRatio, FloatRange.ZeroToOne, 0.001f);
 | 
				
			||||||
				section.CheckboxLabeled(Keyed.Option_7_Label, ref slavesBeenRapedExp, Keyed.Option_7_Desc);
 | 
									section.CheckboxLabeled(Keyed.Option_7_Label, settings.SlavesBeenRapedExp, Keyed.Option_7_Desc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				listmain.EndSection(section);
 | 
									listmain.EndSection(section);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			listmain.CheckboxLabeled(Keyed.Option_EnableSexHistory_Label, ref enableSexHistory, Keyed.Option_EnableSexHistory_Desc);
 | 
								listmain.CheckboxLabeled(Keyed.Option_EnableSexHistory_Label, settings.EnableSexHistory, Keyed.Option_EnableSexHistory_Desc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (enableSexHistory)
 | 
								if (settings.EnableSexHistory)
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				listmain.CheckboxLabeled(Keyed.Option_HideGizmoWhenDrafted_Label, ref hideGizmoWhenDrafted, Keyed.Option_HideGizmoWhenDrafted_Desc);
 | 
									listmain.CheckboxLabeled(Keyed.Option_HideGizmoWhenDrafted_Label, settings.HideGizmoWhenDrafted, Keyed.Option_HideGizmoWhenDrafted_Desc);
 | 
				
			||||||
				listmain.CheckboxLabeled(Keyed.Option_HideGizmoWithRJW_Label, ref hideGizmoWithRJW, Keyed.Option_HideGizmoWithRJW_Desc);
 | 
									listmain.CheckboxLabeled(Keyed.Option_HideGizmoWithRJW_Label, settings.HideGizmoWithRJW, Keyed.Option_HideGizmoWithRJW_Desc);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (listmain.ButtonText(Keyed.Button_ResetToDefault))
 | 
								if (listmain.ButtonText(Keyed.Button_ResetToDefault))
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										41
									
								
								Source/RJWSexperience/Settings/SettingsTabMain.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								Source/RJWSexperience/Settings/SettingsTabMain.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,41 @@
 | 
				
			||||||
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using UnityEngine;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace RJWSexperience.Settings
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						public class SettingsTabMain : SettingsTab
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							public SettingsTabMain(Configurations settings) : base(
 | 
				
			||||||
 | 
								settings,
 | 
				
			||||||
 | 
								Keyed.TabLabelMain,
 | 
				
			||||||
 | 
								new List<ISettingHandle> {
 | 
				
			||||||
 | 
									settings.LustEffectPower,
 | 
				
			||||||
 | 
									settings.EnableBastardRelation,
 | 
				
			||||||
 | 
									settings.LustLimit,
 | 
				
			||||||
 | 
									settings.MaxSingleLustChange,
 | 
				
			||||||
 | 
									settings.SexCanFillBuckets,
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								) { }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public override void DoTabContents(Rect inRect)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								Listing_Standard listmain = new Listing_Standard { maxOneColumn = true };
 | 
				
			||||||
 | 
								listmain.Begin(inRect);
 | 
				
			||||||
 | 
								listmain.SliderOption(Keyed.Option_2_Label + " x{0}", Keyed.Option_2_Desc, settings.LustEffectPower, new FloatRange(0f, 2f), 0.01f);
 | 
				
			||||||
 | 
								listmain.SliderOption(Keyed.Option_8_Label + " {0}", Keyed.Option_8_Desc, settings.LustLimit, new FloatRange(0f, 500f), 1f);
 | 
				
			||||||
 | 
								listmain.SliderOption(Keyed.Option_MaxSingleLustChange_Label + " {0}", Keyed.Option_MaxSingleLustChange_Desc, settings.MaxSingleLustChange, new FloatRange(0f, 10f), 0.05f);
 | 
				
			||||||
 | 
								listmain.CheckboxLabeled(Keyed.Option_EnableBastardRelation_Label, settings.EnableBastardRelation, Keyed.Option_EnableBastardRelation_Desc);
 | 
				
			||||||
 | 
								listmain.CheckboxLabeled(Keyed.Option_SexCanFillBuckets_Label, settings.SexCanFillBuckets, Keyed.Option_SexCanFillBuckets_Desc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (settings.DevMode)
 | 
				
			||||||
 | 
									LustUtility.DrawGraph(listmain.GetRect(300f));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (listmain.ButtonText(Keyed.Button_ResetToDefault))
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									Reset();
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								listmain.End();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -7,30 +7,39 @@ namespace RJWSexperience.Settings
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		public const float lineHeight = 24f;
 | 
							public const float lineHeight = 24f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public static void LabelwithTextfield(Rect rect, string label, string tooltip, ref float value, float min, float max)
 | 
							public static void LabelwithTextfield(Rect rect, string label, string tooltip, ref float value, FloatRange range)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			Rect textfieldRect = new Rect(rect.xMax - 100f, rect.y, 100f, rect.height);
 | 
								Rect textfieldRect = new Rect(rect.xMax - 100f, rect.y, 100f, rect.height);
 | 
				
			||||||
			string valuestr = value.ToString();
 | 
								string valuestr = value.ToString();
 | 
				
			||||||
			Widgets.Label(rect, label);
 | 
								Widgets.Label(rect, label);
 | 
				
			||||||
			Widgets.TextFieldNumeric(textfieldRect, ref value, ref valuestr, min, max);
 | 
								Widgets.TextFieldNumeric(textfieldRect, ref value, ref valuestr, range.TrueMin, range.TrueMax);
 | 
				
			||||||
			Widgets.DrawHighlightIfMouseover(rect);
 | 
								Widgets.DrawHighlightIfMouseover(rect);
 | 
				
			||||||
			TooltipHandler.TipRegion(rect, tooltip);
 | 
								TooltipHandler.TipRegion(rect, tooltip);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public static void SliderOption(Rect doublerect, string label, string tooltip, ref float value, float min, float max, float roundTo)
 | 
							public static void SliderOption(this Listing_Standard outList, string label, string tooltip, SettingHandle<float> handle, FloatRange range, float roundTo)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			// Slider was fighting with textfield for "correct" decimals. Causes a repeating slider move sound
 | 
								// Slider was fighting with textfield for "correct" decimals. Causes a repeating slider move sound
 | 
				
			||||||
			float fieldValue = value;
 | 
								float fieldValue = handle.Value;
 | 
				
			||||||
			float sliderValue = value;
 | 
								float sliderValue = handle.Value;
 | 
				
			||||||
			float minChange = roundTo / 10f;
 | 
								float minChange = roundTo / 10f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			LabelwithTextfield(doublerect.TopHalf(), label, tooltip, ref fieldValue, min, max);
 | 
								string formattedLabel = string.Format(label, handle.Value);
 | 
				
			||||||
			sliderValue = Widgets.HorizontalSlider(doublerect.BottomHalf(), sliderValue, min, max, roundTo: roundTo);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (Mathf.Abs(fieldValue - value) > minChange)
 | 
								LabelwithTextfield(outList.GetRect(lineHeight), formattedLabel, tooltip, ref fieldValue, range);
 | 
				
			||||||
				value = fieldValue;
 | 
								sliderValue = Widgets.HorizontalSlider_NewTemp(outList.GetRect(lineHeight), sliderValue, range.TrueMin, range.TrueMax, roundTo: roundTo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								if (Mathf.Abs(fieldValue - handle.Value) > minChange)
 | 
				
			||||||
 | 
									handle.Value = fieldValue;
 | 
				
			||||||
			else
 | 
								else
 | 
				
			||||||
				value = sliderValue;
 | 
									handle.Value = sliderValue;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							public static void CheckboxLabeled(this Listing_Standard outList, string label, SettingHandle<bool> handle, string tooltip)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								bool value = handle.Value;
 | 
				
			||||||
 | 
								outList.CheckboxLabeled(label, ref value, tooltip);
 | 
				
			||||||
 | 
								handle.Value = value;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -11,7 +11,7 @@ namespace RJWSexperience.SexHistory
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		private static readonly rjw.Modules.Shared.Logs.ILog log = LogManager.GetLogger<DebugLogProvider>("RecordRandomizer");
 | 
							private static readonly rjw.Modules.Shared.Logs.ILog log = LogManager.GetLogger<DebugLogProvider>("RecordRandomizer");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		private static Settings.SettingsTabHistory Settings => SexperienceMod.Settings.History;
 | 
							private static Configurations Settings => SexperienceMod.Settings;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public static bool Randomize(Pawn pawn)
 | 
							public static bool Randomize(Pawn pawn)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -367,7 +367,7 @@ namespace RJWSexperience.SexHistory.UI
 | 
				
			||||||
				if (Widgets.ButtonInvisible(lockRect))
 | 
									if (Widgets.ButtonInvisible(lockRect))
 | 
				
			||||||
				{
 | 
									{
 | 
				
			||||||
					SoundDefOf.Click.PlayOneShotOnCamera();
 | 
										SoundDefOf.Click.PlayOneShotOnCamera();
 | 
				
			||||||
					settings.SelectionLocked = !settings.SelectionLocked;
 | 
										settings.SelectionLocked.Value = !settings.SelectionLocked.Value;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -7,8 +7,7 @@ namespace RJWSexperience
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	public class SexperienceMod : Mod
 | 
						public class SexperienceMod : Mod
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		private static Configurations settings;
 | 
							public static Configurations Settings { get; private set; }
 | 
				
			||||||
		public static Configurations Settings { get => settings; }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public ITab CurrentTab { get; private set; }
 | 
							public ITab CurrentTab { get; private set; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -16,8 +15,7 @@ namespace RJWSexperience
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public SexperienceMod(ModContentPack content) : base(content)
 | 
							public SexperienceMod(ModContentPack content) : base(content)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			settings = GetSettings<Configurations>();
 | 
								Settings = GetSettings<Configurations>();
 | 
				
			||||||
			CurrentTab = settings;
 | 
					 | 
				
			||||||
			tabRecords = new List<TabRecord>();
 | 
								tabRecords = new List<TabRecord>();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -34,13 +32,15 @@ namespace RJWSexperience
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			List<ITab> tabs = new List<ITab>
 | 
								List<ITab> tabs = new List<ITab>
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
				settings,
 | 
									new SettingsTabMain(Settings),
 | 
				
			||||||
				settings.History,
 | 
									new SettingsTabHistory(Settings),
 | 
				
			||||||
				settings.Debug
 | 
									new SettingsTabDebug(Settings),
 | 
				
			||||||
			};
 | 
								};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			foreach (ITab tab in tabs)
 | 
								foreach (ITab tab in tabs)
 | 
				
			||||||
				tabRecords.Add(new TabRecord(tab.Label, delegate { this.CurrentTab = tab; }, delegate { return this?.CurrentTab == tab; }));
 | 
									tabRecords.Add(new TabRecord(tab.Label, delegate { this.CurrentTab = tab; }, delegate { return this?.CurrentTab == tab; }));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								CurrentTab = tabs[0];
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public override void DoSettingsWindowContents(Rect inRect)
 | 
							public override void DoSettingsWindowContents(Rect inRect)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -47,7 +47,7 @@
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <PackageReference Include="Krafs.Rimworld.Ref">
 | 
					    <PackageReference Include="Krafs.Rimworld.Ref">
 | 
				
			||||||
      <Version>1.4.3524</Version>
 | 
					      <Version>1.4.3641</Version>
 | 
				
			||||||
    </PackageReference>
 | 
					    </PackageReference>
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue