Replace HarmonyPatch_PawnRenderer.cs

This commit is contained in:
AbstractConcept 2022-09-07 05:13:51 +00:00
parent c08601b81f
commit 37f7f3c0ef

View file

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HarmonyLib;
using RimWorld;
using Verse;
@ -66,18 +64,21 @@ namespace Rimworld_Animations {
//headFacing equals true
}
// Fixes the offsets for eye implants and wounds on the head during animations
else if (ins[i].opcode == OpCodes.Callvirt && ins[i].operand != null && ins[i].OperandIs(AccessTools.DeclaredMethod(typeof(PawnWoundDrawer), "RenderOverBody")))
{
// Pass some additional info to a new overload of RenderOverBody
yield return new CodeInstruction(OpCodes.Ldarg_0);
yield return new CodeInstruction(OpCodes.Ldfld, AccessTools.DeclaredField(typeof(PawnRenderer), "pawn"));
yield return new CodeInstruction(OpCodes.Ldarg_S, (object)6); // renderer flags
yield return new CodeInstruction(OpCodes.Call, AccessTools.DeclaredMethod(typeof(PawnWoundDrawerExtension), "RenderOverBody"));
}
else
{
yield return ins[i];
}
}
}
}
}