24 lines
576 B
C#
24 lines
576 B
C#
using HarmonyLib;
|
|
using Verse;
|
|
|
|
namespace Rimworld_Animations {
|
|
[HarmonyPatch(typeof(Thing), nameof(Thing.Rotation), MethodType.Getter)]
|
|
public static class HarmonyPatch_PawnRotation {
|
|
|
|
public static bool Prefix(Thing __instance, ref Rot4 __result) {
|
|
|
|
if (!(__instance is Pawn pawn)) {
|
|
return true;
|
|
}
|
|
|
|
if (!CompBodyAnimator.IsAnimating(pawn)) {
|
|
return true;
|
|
}
|
|
|
|
__result = pawn.TryGetComp<CompBodyAnimator>().bodyFacing;
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|