mirror of
https://gitgud.io/AbstractConcept/rimworld-animations-patch.git
synced 2024-08-15 00:43:27 +00:00
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
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<CompApparelVisibility>() != null && x.TryGetComp<CompApparelVisibility>().isBeingWorn.HasValue))
|
|
{ __result = true; }
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|