From 37f7f3c0ef4b2b56fc3d1e82daad896556fc9bf1 Mon Sep 17 00:00:00 2001 From: AbstractConcept Date: Wed, 7 Sep 2022 05:13:51 +0000 Subject: [PATCH] Replace HarmonyPatch_PawnRenderer.cs --- .../HarmonyPatch_PawnRenderer.cs | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/1.3/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs b/1.3/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs index 7514963..218e45b 100644 --- a/1.3/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs +++ b/1.3/Source/Patches/RimworldPatches/HarmonyPatch_PawnRenderer.cs @@ -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]; - } - - + } } - } - } - - - }