This commit is contained in:
c0ffee 2021-07-21 13:25:06 -07:00
parent 6d4ed2a9e3
commit 1eea564e30
5 changed files with 6 additions and 25 deletions

View File

@ -279,6 +279,8 @@ namespace Rimworld_Animations {
public static Rot4 PawnHeadRotInAnimation(Pawn pawn, Rot4 regularPos)
{
Debug.Log("Test");
if(pawn?.TryGetComp<CompBodyAnimator>() != null && pawn.TryGetComp<CompBodyAnimator>().isAnimating)
{
return pawn.TryGetComp<CompBodyAnimator>().headFacing;

View File

@ -32,6 +32,7 @@ namespace Rimworld_Animations {
actorsInCurrentAnimation = null;
}
PortraitsCache.SetDirty(pawn);
}
}
private bool Animating = false;

View File

@ -46,9 +46,6 @@ namespace Rimworld_Animations {
foreach (CodeInstruction i in instructions)
{
if (i.opcode == OpCodes.Ldfld && i.OperandIs(AccessTools.Field(typeof(PawnGraphicSet), "headGraphic")))
{
@ -57,13 +54,14 @@ namespace Rimworld_Animations {
yield return i;
}
else if (forHead && i.operand == (object)7)
else if (forHead && i.opcode == OpCodes.Ldarg_S && i.operand == (object)4)
{
yield return new CodeInstruction(OpCodes.Ldarg_0);
yield return new CodeInstruction(OpCodes.Ldfld, AccessTools.Field(typeof(PawnRenderer), "pawn"));
yield return new CodeInstruction(OpCodes.Ldloc_S, operand: 7);
yield return new CodeInstruction(OpCodes.Ldloc_S, operand: 4);
yield return new CodeInstruction(OpCodes.Call, AccessTools.Method(typeof(AnimationUtility), "PawnHeadRotInAnimation"));
}
else

View File

@ -26,24 +26,4 @@ namespace Rimworld_Animations {
}
[HarmonyPatch(typeof(PawnRenderer), "BodyAngle")]
public static class HarmonyPatch_PawnAngle
{
public static bool Prefix(Pawn ___pawn, ref float __result)
{
if(___pawn.TryGetComp<CompBodyAnimator>().isAnimating)
{
__result = ___pawn.TryGetComp<CompBodyAnimator>().bodyAngle;
return false;
}
return true;
}
}
}