mirror of
https://gitgud.io/AbstractConcept/rimworld-animations-patch.git
synced 2024-08-15 00:43:27 +00:00
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using RimWorld;
|
|
using Verse;
|
|
using HarmonyLib;
|
|
|
|
namespace Rimworld_Animations_Patch
|
|
{
|
|
[HarmonyPatch(typeof(Pawn_ApparelTracker), "HasBasicApparel")]
|
|
public static class HarmonyPatch_Pawn_ApparelTracker_HasBasicApparel
|
|
{
|
|
public static void Postfix(Pawn_ApparelTracker __instance, ref bool hasPants, ref bool hasShirt)
|
|
{
|
|
if (__instance?.pawn?.apparel?.WornApparel == null || __instance.pawn.apparel.WornApparel.NullOrEmpty()) return;
|
|
|
|
if (hasPants == false)
|
|
{
|
|
if (__instance.pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(PatchBodyPartGroupDefOf.GenitalsBPG)))
|
|
{ hasPants = true; }
|
|
}
|
|
|
|
if (hasShirt == false)
|
|
{
|
|
if (__instance.pawn.apparel.WornApparel.Any(x => x.def.apparel.bodyPartGroups.Contains(PatchBodyPartGroupDefOf.ChestBPG)))
|
|
{ hasShirt = true; }
|
|
}
|
|
}
|
|
}
|
|
|
|
[HarmonyPatch(typeof(Pawn_ApparelTracker), "Notify_ApparelChanged")]
|
|
public static class HarmonyPatch_Pawn_ApparelTracker_Notify_ApparelChanged
|
|
{
|
|
public static void Postfix(Pawn_ApparelTracker __instance)
|
|
{
|
|
__instance?.pawn?.TryGetComp<CompPawnSexData>()?.UpdateBodyAddonVisibility();
|
|
}
|
|
}
|
|
|
|
|
|
}
|