using System;
using System.Collections.Generic;
using Verse;
using RimWorld;
using HarmonyLib;

namespace SCE.Patches
{
    [HarmonyPatch]
    public class NudityPatches
    {
        [HarmonyPatch(typeof(PawnApparelGenerator), "CanUseStuff")]
        [HarmonyPrefix]
        public static bool PawnApparelGenerator_FilterPartialNudityPrecepts(Pawn pawn, ThingStuffPair pair, ref bool __result)
        {
            if (pawn.IdeoForbidsWearing(pair.thing))
            {
                __result = false;
                return false;
            }

            return true;
        }

        [HarmonyPatch(typeof(ApparelRequirement), "RequiredForPawn")]
        [HarmonyPostfix]
        public static void NullifyForPartialNudityPrecepts(Pawn p, ThingDef apparel, ref bool __result)
        {
            __result = __result && !p.IdeoForbidsWearing(apparel);
        }
    }
}
