rjw-quirks/RJW-Quirks/HarmonyPatches/Patch_QuirkPartPreference.cs

29 lines
1.1 KiB
C#

using HarmonyLib;
using rjw.Modules.Interactions.Contexts;
using rjw.Modules.Interactions.Internals.Implementation;
using rjw.Modules.Interactions.Rules.PartKindUsageRules;
using rjwquirks.Modules.Interactions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace rjwquirks.HarmonyPatches
{
[HarmonyPatch(typeof(PartPreferenceDetectorService), nameof(PartPreferenceDetectorService.DetectPartPreferences))]
public class Patch_QuirkPartPreference
{
public static void Prefix(InteractionContext context, IList<IPartPreferenceRule> ____partKindUsageRules)
{
if (____partKindUsageRules.Any(x => x.GetType() == typeof(QuirksPartKindUsageRule)) || (context.Internals.Submissive.Pawn.GetQuirks() == null || context.Internals.Dominant.Pawn.GetQuirks() == null))
return;
Log.Warning(____partKindUsageRules.Count().ToString());
____partKindUsageRules.Add(new QuirksPartKindUsageRule());
Log.Warning(____partKindUsageRules.Count().ToString());
}
}
}