New settings handling

This commit is contained in:
amevarashi 2023-03-24 20:22:54 +05:00
parent fed4b54915
commit 8d49addd63
24 changed files with 309 additions and 233 deletions

View 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;
}
}
}*/

View file

@ -11,7 +11,7 @@ namespace RJWSexperience
{
static DefInjection()
{
if (SexperienceMod.Settings.History.EnableSexHistory)
if (SexperienceMod.Settings.EnableSexHistory)
InjectRaces();
}

View file

@ -9,7 +9,7 @@ namespace RJWSexperience
{
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)
{

View file

@ -44,7 +44,7 @@ namespace RJWSexperience
LustUtility.UpdateLust(props, satisfaction, base_sat_per_fuck);
CumUtility.FillCumBuckets(props);
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);
}
}
@ -80,7 +80,7 @@ namespace RJWSexperience
{
RJWUtility.UpdateSextypeRecords(props);
if (!SexperienceMod.Settings.History.EnableSexHistory || props.partner == null)
if (!SexperienceMod.Settings.EnableSexHistory || props.partner == null)
return;
props.pawn.TryGetComp<SexHistoryComp>()?.RecordSex(props.partner, props);

View file

@ -16,7 +16,7 @@ namespace RJWSexperience
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);
if (doVirginTrait)