HatsDisplaySelection patches

This commit is contained in:
c0ffee 2021-05-07 21:02:55 -07:00
parent acfb864629
commit 8deae217e0
13 changed files with 208 additions and 12 deletions

View file

@ -1,4 +1,4 @@
/*using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -19,8 +19,34 @@ namespace Rimworld_Animations {
(new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("HatDisplaySelection.Patch"), "DrawHatWithHair"),
transpiler: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_HatsDisplaySelection), "ReplaceDrawMeshOrLaterWithAnimate")));
(new Harmony("rjw")).Patch(AccessTools.Method(AccessTools.TypeByName("HatDisplaySelection.Patch"), "DrawHeadApparelWithHair"),
prefix: new HarmonyMethod(AccessTools.Method(typeof(HarmonyPatch_HatsDisplaySelection), "PrefixPatchForDrawHeadApparelWithHair")));
}
public static void PrefixPatchForDrawHeadApparelWithHair(PawnRenderer renderer, ref Vector3 rootLoc, ref float angle, bool renderBody, ref Rot4 bodyFacing, ref Rot4 headFacing, RotDrawMode bodyDrawType, bool portrait, bool headStump, bool invisible)
{
PawnGraphicSet graphics = renderer.graphics;
Pawn pawn = graphics.pawn;
CompBodyAnimator bodyAnim = pawn.TryGetComp<CompBodyAnimator>();
if (!graphics.AllResolved)
{
graphics.ResolveAllGraphics();
}
if (bodyAnim != null && bodyAnim.isAnimating && !portrait && pawn.Map == Find.CurrentMap)
{
bodyAnim.tickGraphics(graphics);
bodyAnim.animatePawn(ref rootLoc, ref angle, ref bodyFacing, ref headFacing);
}
}
public static IEnumerable<CodeInstruction> ReplaceDrawMeshOrLaterWithAnimate(IEnumerable<CodeInstruction> instructions) {
MethodInfo drawMeshNowOrLater = AccessTools.Method(typeof(GenDraw), "DrawMeshNowOrLater");
@ -44,4 +70,4 @@ namespace Rimworld_Animations {
}
}
}*/
}

View file

@ -51,19 +51,20 @@ namespace Rimworld_Animations {
{
static HarmonyPatch_Animate() {
/* hats display selection patch -- broken
// hats display selection patch -- broken
if (LoadedModManager.RunningModsListForReading.Any(x => x.Name == "Hats Display Selection")) {
HarmonyPatch_HatsDisplaySelection.PatchHatsDisplaySelectionArgs();
}
else {
PatchRimworldFunctionsNormally();
}*/
}
PatchRimworldFunctionsNormally();
//PatchRimworldFunctionsNormally();
}
static void PatchRimworldFunctionsNormally() {
(new Harmony("rjw")).Patch(AccessTools.Method(typeof(PawnRenderer), "RenderPawnInternal", parameters: new Type[]
{