mirror of
https://gitgud.io/AbstractConcept/rimworld-animations-patch.git
synced 2024-08-15 00:43:27 +00:00
45 lines
No EOL
1.1 KiB
C#
45 lines
No EOL
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using HarmonyLib;
|
|
using RimWorld;
|
|
using Verse;
|
|
using UnityEngine;
|
|
using System.Reflection;
|
|
using System.Reflection.Emit;
|
|
using Rimworld_Animations;
|
|
using rjw;
|
|
|
|
namespace Rimworld_Animations_Patch
|
|
{
|
|
[StaticConstructorOnStartup]
|
|
[HarmonyPatch(typeof(PawnGraphicSet), "ResolveAllGraphics")]
|
|
public static class HarmonyPatch_PawnGraphicSet_ResolveAllGraphics
|
|
{
|
|
// Update whether body parts are visible after resolving graphics
|
|
public static void Postfix(PawnGraphicSet __instance)
|
|
{
|
|
if (__instance?.pawn?.apparel == null)
|
|
{ return; }
|
|
|
|
if (__instance.pawn.GetAnimationData() != null)
|
|
{ return; }
|
|
|
|
if (__instance.pawn.apparel.WornApparel.NullOrEmpty() == false)
|
|
{
|
|
foreach (Apparel apparel in __instance.pawn.apparel.WornApparel)
|
|
{
|
|
CompApparelVisibility comp = apparel.TryGetComp<CompApparelVisibility>();
|
|
|
|
if (comp != null)
|
|
{
|
|
comp.isBeingWorn = null;
|
|
comp.rimNudeDataStatus = RimNudeDataStatus.NotLoaded;
|
|
}
|
|
}
|
|
}
|
|
|
|
__instance.pawn.TryGetComp<CompPawnSexData>()?.UpdateBodyAddonVisibility();
|
|
}
|
|
}
|
|
} |