rjw-quirks/RJW-Quirks/HarmonyPatches/Patch_PartPreferenceDetecto...

27 lines
1007 B
C#
Raw Normal View History

2022-11-01 16:15:06 +00:00
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_PartPreferenceDetectorService
2022-11-01 16:15:06 +00:00
{
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;
____partKindUsageRules.Add(new QuirksPartKindUsageRule());
}
}
}