using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; using HarmonyLib; using RJW_Events; namespace Rimworld_Animations_Patch { [StaticConstructorOnStartup] public static class HarmonyPatch_RJWEvents { static HarmonyPatch_RJWEvents() { try { ((Action)(() => { if (LoadedModManager.RunningModsListForReading.Any(x => x.PackageIdPlayerFacing == "c0ffee.rjw.events")) { (new Harmony("Rimworld_Animations_Patch")).Patch(AccessTools.Method(typeof(ThinkNode_ConditionalNude), "Satisfied"), prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_RJWEvents), "Postfix_ThinkNode_ConditionalNude_Satisfied"))); } }))(); } catch (TypeLoadException) { } } public static bool Postfix_ThinkNode_ConditionalNude_Satisfied(ref bool __result, Pawn pawn) { if (__result == false && pawn?.apparel?.WornApparel != null) { // If 'isBeingWorn' has a value, the apparel has already been checked if it should be discarded if (pawn.apparel.WornApparel.NullOrEmpty() || pawn.apparel.WornApparel.Any(x => x.TryGetComp() != null && x.TryGetComp().isBeingWorn.HasValue)) { __result = true; } } return false; } } }